Skip to content

Commit 3d543a0

Browse files
committed
Merge branch '4.x'
2 parents 9bf0f27 + 234339a commit 3d543a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+785
-1722
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@
4848
*.webm binary
4949
*.mp4 binary
5050
*.ogv binary
51+
52+
# Remove files for archives generated using `git archive`
53+
phpstan.neon export-ignore
54+
.travis.yml export-ignore
55+
.github export-ignore

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Thumbs.db
2020

2121
# Tool specific files #
2222
#######################
23+
# PHPUnit
24+
.phpunit.result.cache
2325
# vim
2426
*~
2527
*.swp

.travis.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
language: php
22

33
php:
4-
- 5.6
4+
- 7.2
5+
- 7.3
56
- 7.4
67

78
env:
@@ -13,17 +14,18 @@ matrix:
1314
- php: 7.3
1415
env: CHECKS=1 DEFAULT=0
1516

17+
before_install:
18+
- phpenv config-rm xdebug.ini
19+
1620
before_script:
17-
- composer install --no-interaction
21+
- if [[ $DEFAULT == 1 || $PHPCS == 1 ]]; then composer install; fi
1822
- if [[ $DEFAULT == 1 ]]; then composer run-script post-install-cmd --no-interaction; fi
19-
20-
- if [[ $CHECKS == 1 ]]; then composer stan-setup; fi
23+
- if [[ $PHPSTAN == 1 ]]; then composer require --dev phpstan/phpstan-shim:^0.11; fi
2124

2225
script:
23-
- if [[ $DEFAULT == 1 ]]; then composer test; fi
24-
25-
- if [[ $CHECKS == 1 ]]; then composer cs-check; fi
26-
- if [[ $CHECKS == 1 ]]; then composer stan; fi
26+
- if [[ $DEFAULT == 1 ]]; then vendor/bin/phpunit; fi
27+
- if [[ $PHPCS == 1 ]]; then composer cs-check; fi
28+
- if [[ $PHPSTAN == 1 ]]; then vendor/bin/phpstan analyse src/; fi
2729

2830
cache:
2931
directories:

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22

33
[![Build Status](https://img.shields.io/travis/cakephp/app/master.svg?style=flat-square)](https://travis-ci.org/cakephp/app)
44
[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/app.svg?style=flat-square)](https://packagist.org/packages/cakephp/app)
5+
[![PHPStan](https://img.shields.io/badge/PHPStan-level%207-brightgreen.svg?style=flat-square)](https://github.com/phpstan/phpstan)
56

6-
A skeleton for creating applications with [CakePHP](https://cakephp.org) 3.x.
7+
A skeleton for creating applications with [CakePHP](https://cakephp.org) 4.x.
78

89
The framework source code can be found here: [cakephp/cakephp](https://github.com/cakephp/cakephp).
910

1011
## Installation
1112

1213
1. Download [Composer](https://getcomposer.org/doc/00-intro.md) or update `composer self-update`.
13-
2. Run `php composer.phar create-project --prefer-dist cakephp/app [app_name]`.
14+
2. Run `php composer.phar create-project --prefer-dist --stability=dev cakephp/app [app_name]`.
1415

1516
If Composer is installed globally, run
1617

1718
```bash
18-
composer create-project --prefer-dist cakephp/app
19+
composer create-project --prefer-dist --stability=dev cakephp/app:4.x
1920
```
2021

2122
In case you want to use a custom app dir name (e.g. `/myapp/`):
2223

2324
```bash
24-
composer create-project --prefer-dist cakephp/app myapp
25+
composer create-project --prefer-dist --stability=dev cakephp/app:4.x myapp
2526
```
2627

2728
You can now either use your machine's webserver to view the default home page, or start
@@ -41,11 +42,12 @@ automated upgrades, so you have to do any updates manually.
4142

4243
## Configuration
4344

44-
Read and edit `config/app.php` and setup the `'Datasources'` and any other
45-
configuration relevant for your application.
45+
Read and edit the environment specific `config/app_local.php` and setup the
46+
`'Datasources'` and any other configuration relevant for your application.
47+
Other environment agnostic settings can be changed in `config/app.php`.
4648

4749
## Layout
4850

49-
The app skeleton uses a subset of [Foundation](http://foundation.zurb.com/) (v5) CSS
51+
The app skeleton uses [Milligram](https://milligram.io/) (v1.3) minimalist CSS
5052
framework by default. You can, however, replace it with any other library or
5153
custom styles.

composer.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
"type": "project",
66
"license": "MIT",
77
"require": {
8-
"php": ">=5.6",
9-
"cakephp/cakephp": "3.8.*",
10-
"cakephp/migrations": "^2.0.0",
8+
"php": ">=7.2",
9+
"cakephp/cakephp": "^4.0",
10+
"cakephp/migrations": "3.0.0-beta1",
1111
"cakephp/plugin-installer": "^1.0",
1212
"mobiledetect/mobiledetectlib": "2.*"
1313
},
1414
"require-dev": {
15-
"cakephp/bake": "^1.9.0",
16-
"cakephp/cakephp-codesniffer": "^3.0",
17-
"cakephp/debug_kit": "^3.17.0",
15+
"cakephp/bake": "^4.0",
16+
"cakephp/cakephp-codesniffer": "dev-next",
17+
"cakephp/debug_kit": "^4.0",
1818
"josegonzalez/dotenv": "3.*",
19-
"phpunit/phpunit": "^5|^6",
19+
"phpunit/phpunit": "^8.0",
2020
"psy/psysh": "@stable"
2121
},
2222
"suggest": {
@@ -42,14 +42,15 @@
4242
"@test",
4343
"@cs-check"
4444
],
45-
"cs-check": "phpcs --colors -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/ config/ webroot/",
46-
"cs-fix": "phpcbf --colors -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/ config/ webroot/",
47-
"stan": "phpstan analyse -l 5 src/",
45+
"cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
46+
"cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
47+
"stan": "phpstan analyse src/",
4848
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan-shim:^0.11 && mv composer.backup composer.json",
4949
"test": "phpunit --colors=always"
5050
},
5151
"prefer-stable": true,
5252
"config": {
5353
"sort-packages": true
54-
}
54+
},
55+
"minimum-stability": "dev"
5556
}

config/app.php

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
'jsBaseUrl' => 'js/',
6464
'paths' => [
6565
'plugins' => [ROOT . DS . 'plugins' . DS],
66-
'templates' => [APP . 'Template' . DS],
67-
'locales' => [APP . 'Locale' . DS],
66+
'templates' => [ROOT . DS . 'templates' . DS],
67+
'locales' => [RESOURCES . 'locales' . DS],
6868
],
6969
],
7070

@@ -111,7 +111,7 @@
111111
'_cake_core_' => [
112112
'className' => FileEngine::class,
113113
'prefix' => 'myapp_cake_core_',
114-
'path' => CACHE . 'persistent/',
114+
'path' => CACHE . 'persistent' . DS,
115115
'serialize' => true,
116116
'duration' => '+1 years',
117117
'url' => env('CACHE_CAKECORE_URL', null),
@@ -126,7 +126,7 @@
126126
'_cake_model_' => [
127127
'className' => FileEngine::class,
128128
'prefix' => 'myapp_cake_model_',
129-
'path' => CACHE . 'models/',
129+
'path' => CACHE . 'models' . DS,
130130
'serialize' => true,
131131
'duration' => '+1 years',
132132
'url' => env('CACHE_CAKEMODEL_URL', null),
@@ -259,28 +259,32 @@
259259
* other RDBMS.
260260
*/
261261
'Datasources' => [
262+
/**
263+
* These configurations should contain permanent settings used
264+
* by all environments.
265+
*
266+
* The values in app_local.php will override any values set here
267+
* and should be used for local and per-environment configurations.
268+
*
269+
* Environment variable based configurations can be loaded here or
270+
* in app_local.php depending on the applications needs.
271+
*/
262272
'default' => [
263273
'className' => Connection::class,
264274
'driver' => Mysql::class,
265275
'persistent' => false,
266-
'host' => 'localhost',
267-
/*
268-
* CakePHP will use the default DB port based on the driver selected
269-
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
270-
* the following line and set the port accordingly
271-
*/
272-
//'port' => 'non_standard_port_number',
273-
/*
274-
* It is recommended to set these options through your environment or app_local.php
275-
*/
276-
//'username' => 'my_app',
277-
//'password' => 'secret',
278-
//'database' => 'my_app',
279-
/*
280-
* You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6).
276+
'timezone' => 'UTC',
277+
278+
/**
279+
* For MariaDB/MySQL the internal default changed from utf8 to utf8mb4, aka full utf-8 support, in CakePHP 3.6
281280
*/
282281
//'encoding' => 'utf8mb4',
283-
'timezone' => 'UTC',
282+
283+
/**
284+
* If your MySQL server is configured with `skip-character-set-client-handshake`
285+
* then you MUST use the `flags` config to set your charset encoding.
286+
* For e.g. `'flags' => [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4']`
287+
*/
284288
'flags' => [],
285289
'cacheMetadata' => true,
286290
'log' => false,
@@ -303,8 +307,6 @@
303307
* which is the recommended value in production environments
304308
*/
305309
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
306-
307-
'url' => env('DATABASE_URL', null),
308310
],
309311

310312
/*
@@ -314,18 +316,13 @@
314316
'className' => Connection::class,
315317
'driver' => Mysql::class,
316318
'persistent' => false,
317-
'host' => 'localhost',
318-
//'port' => 'non_standard_port_number',
319-
'username' => 'my_app',
320-
'password' => 'secret',
321-
'database' => 'test_myapp',
322-
//'encoding' => 'utf8mb4',
323319
'timezone' => 'UTC',
320+
//'encoding' => 'utf8mb4',
321+
'flags' => [],
324322
'cacheMetadata' => true,
325323
'quoteIdentifiers' => false,
326324
'log' => false,
327325
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
328-
'url' => env('DATABASE_TEST_URL', null),
329326
],
330327
],
331328

@@ -368,8 +365,8 @@
368365
*
369366
* ## Options
370367
*
371-
* - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'. Avoid using `.` in cookie names,
372-
* as PHP will drop sessions from cookies with `.` in the name.
368+
* - `cookie` - The name of the cookie to use. Defaults to value set for `session.name` php.ini config.
369+
* Avoid using `.` in cookie names, as PHP will drop sessions from cookies with `.` in the name.
373370
* - `cookiePath` - The url path for which session cookie is set. Maps to the
374371
* `session.cookie_path` php.ini config. Defaults to base path of app.
375372
* - `timeout` - The time in minutes the session should be valid for.

config/app_local.example.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,34 @@
4343
* the following line and set the port accordingly
4444
*/
4545
//'port' => 'non_standard_port_number',
46+
4647
'username' => 'my_app',
4748
'password' => 'secret',
49+
4850
'database' => 'my_app',
49-
'log' => true,
51+
/**
52+
* If not using the default 'public' schema with the PostgreSQL driver
53+
* set it here.
54+
*/
55+
//'schema' => 'myapp',
56+
57+
/**
58+
* You can use a DSN string to set the entire configuration
59+
*/
5060
'url' => env('DATABASE_URL', null),
5161
],
62+
63+
/*
64+
* The test connection is used during the test suite.
65+
*/
66+
'test' => [
67+
'host' => 'localhost',
68+
//'port' => 'non_standard_port_number',
69+
'username' => 'my_app',
70+
'password' => 'secret',
71+
'database' => 'test_myapp',
72+
//'schema' => 'myapp',
73+
],
5274
],
5375

5476
/*

0 commit comments

Comments
 (0)