Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ trim_trailing_whitespace = true
end_of_line = crlf

[*.yml]
indent_style = space
indent_size = 2

[*.twig]
insert_final_newline = false

[*.neon]
indent_style = tab

[Makefile]
indent_style = tab
36 changes: 15 additions & 21 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
# Define the line ending behavior of the different file extensions
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
* text eol=lf

# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.php text
*.default text
*.ctp text
*.sql text
*.md text
*.po text
*.js text
*.css text
*.ini text
*.properties text
*.txt text
*.xml text
*.svg text
*.yml text
.htaccess text
# Set default behavior, in case users don't have core.autocrlf set.
* text text=auto eol=lf

# Declare files that will always have CRLF line endings on checkout.
*.bat eol=crlf
Expand All @@ -30,13 +11,26 @@
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.webp binary
*.avif binary
*.ico binary
*.mo binary
*.pdf binary
*.xls binary
*.xlsx binary
*.phar binary
*.woff binary
*.woff2 binary
*.ttc binary
*.ttf binary
*.otf binary
*.eot binary
*.gz binary
*.bz2 binary
*.7z binary
*.zip binary
*.webm binary
*.mp4 binary
*.ogv binary
6 changes: 5 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!---

**PLEASE NOTE:**

This is only a issue tracker for issues related to the CakePHP Application Skeleton.
Expand All @@ -7,4 +9,6 @@ Describe the big picture of your changes here to communicate to the maintainers

The best way to propose a feature is to open an issue first and discuss your ideas there before implementing them.

Always follow the [contribution guidelines](https://github.com/cakephp/cakephp/blob/master/.github/CONTRIBUTING.md) guidelines when submitting a pull request. In particular, make sure existing tests still pass, and add tests for all new behavior. When fixing a bug, you may want to add a test to verify the fix.
Always follow the [contribution guidelines](https://github.com/cakephp/cakephp/blob/master/.github/CONTRIBUTING.md) guidelines when submitting a pull request. In particular, make sure existing tests still pass, and add tests for all new behavior. When fixing a bug, you may want to add a test to verify the fix.

-->
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI

on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
workflow_dispatch:

permissions:
contents: read

jobs:
testsuite:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- php-version: '8.2'
dependencies: 'highest'
- php-version: '8.3'
dependencies: 'highest'
- php-version: '8.4'
dependencies: 'highest'
- php-version: '8.5'
dependencies: 'highest'

steps:
- uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, pdo_sqlite
ini-values: zend.assertions=1
coverage: none

- name: Composer install
uses: ramsey/composer-install@v4
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: ${{ matrix.composer-options }}

- name: Composer post install
run: composer run-script post-install-cmd --no-interaction

- name: Run PHPUnit
run: vendor/bin/phpunit
env:
DATABASE_TEST_URL: sqlite://./testdb.sqlite

coding-standard:
name: Coding Standard & Static Analysis
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: mbstring, intl
coverage: none
tools: cs2pr

- name: Composer install
uses: ramsey/composer-install@v4

- name: Run PHP CodeSniffer
run: vendor/bin/phpcs --report=checkstyle | cs2pr

- name: Run phpstan
if: always()
run: vendor/bin/phpstan analyse --no-progress
env:
SECURITY_SALT: f76f1c8475585c46c6acd3ddcb8f5e0f15de524637bb4080a08c4afe7cfc9144
29 changes: 29 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Mark stale issues and pull requests

on:
schedule:
- cron: "0 0 * * *"

permissions:
contents: read

jobs:
stale:

permissions:
issues: write # for actions/stale to close stale issues
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v10
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open for 120 days with no activity. Remove the `stale` label or comment or this will be closed in 15 days'
stale-pr-message: 'This pull request is stale because it has been open 30 days with no activity. Remove the `stale` label or comment on this issue, or it will be closed in 15 days'
stale-issue-label: 'stale'
stale-pr-label: 'stale'
days-before-stale: 120
days-before-close: 15
exempt-issue-labels: 'pinned'
exempt-pr-labels: 'pinned'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ nbproject/* # NetBeans
config/Migrations/schema-dump-default.lock
database
cms-tutorial-database.sqlite
/.phpunit.cache/
1 change: 1 addition & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(\.well-known/.*)$ $1 [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
The completed CMS tutorial application created during
https://book.cakephp.org/5/en/tutorials-and-examples/cms/installation.html

## Requirements

* PHP 8.2 or higher (tested on 8.2, 8.3, 8.4 and 8.5), with the `intl`, `mbstring` and `pdo_sqlite` extensions.
* [Composer](https://getcomposer.org/doc/00-intro.md).

## Installation

1. Download [Composer](https://getcomposer.org/doc/00-intro.md) or update `composer self-update`.
Expand All @@ -14,6 +19,9 @@ cd cms-tutorial
composer install
```

Composer also runs the installer, which creates `config/app_local.php` from `config/app_local.example.php`
and sets the `Security.salt` value.

## Configuration

You can use the default configuration, using a sqlite3 file based database. In that case, no configuration
Expand All @@ -36,5 +44,27 @@ bin/cake server

Then point your browser to http://localhost:8765

You will be redirected to the `/users/login` page. This is the behavior we configured to request a valid
username and password. The CMS Tutorial user Authentication and Authorization to identify the users.
You will see the list of articles. Adding or editing articles requires a logged in user, so you will be
redirected to the `/users/login` page, where you can also sign up. The CMS Tutorial uses Authentication and
Authorization to identify the users and to decide what they can do.

## Production

Set the `APP_FULL_BASE_URL` environment variable (for example `APP_FULL_BASE_URL=https://example.com`)
or `App.fullBaseUrl` in `config/app_local.php`. With `debug` off, the `HostHeaderMiddleware` rejects the
requests whose `Host` header does not match it, to prevent Host header injection.

## Permissions

* Anyone can read the articles and the tags, and sign up as a user.
* Logged in users can add articles, and edit or delete their own articles.
* Logged in users can add and edit tags, but nobody can delete them.
* Users can only see, edit or delete their own user.

## Running the tests and the code checks

```bash
composer test # phpunit
composer cs-check # phpcs, CakePHP coding standard
composer stan # phpstan
```
47 changes: 47 additions & 0 deletions bin/bash_completion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Bash completion file for CakePHP console.
# Copy this file to a file named `cake` under `/etc/bash_completion.d/`.
# For more info check https://book.cakephp.org/5/en/console-commands/completion.html#how-to-enable-bash-autocompletion-for-the-cakephp-console
#

_cake()
{
local cur prev opts cake
COMPREPLY=()
cake="${COMP_WORDS[0]}"
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

if [[ "$cur" == -* ]] ; then
if [[ ${COMP_CWORD} = 1 ]] ; then
opts=$(${cake} completion options)
elif [[ ${COMP_CWORD} = 2 ]] ; then
opts=$(${cake} completion options "${COMP_WORDS[1]}")
else
opts=$(${cake} completion options "${COMP_WORDS[1]}" "${COMP_WORDS[2]}")
fi

COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi

if [[ ${COMP_CWORD} = 1 ]] ; then
opts=$(${cake} completion commands)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi

if [[ ${COMP_CWORD} = 2 ]] ; then
opts=$(${cake} completion subcommands $prev)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
if [[ $COMPREPLY = "" ]] ; then
_filedir
return 0
fi
return 0
fi

return 0
}

complete -F _cake cake bin/cake
Loading