Skip to content

Commit

Permalink
Merge branch '4.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 16, 2019
2 parents 9bf0f27 + 234339a commit 3d543a0
Show file tree
Hide file tree
Showing 63 changed files with 785 additions and 1,722 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@
*.webm binary
*.mp4 binary
*.ogv binary

# Remove files for archives generated using `git archive`
phpstan.neon export-ignore
.travis.yml export-ignore
.github export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Thumbs.db

# Tool specific files #
#######################
# PHPUnit
.phpunit.result.cache
# vim
*~
*.swp
Expand Down
18 changes: 10 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: php

php:
- 5.6
- 7.2
- 7.3
- 7.4

env:
Expand All @@ -13,17 +14,18 @@ matrix:
- php: 7.3
env: CHECKS=1 DEFAULT=0

before_install:
- phpenv config-rm xdebug.ini

before_script:
- composer install --no-interaction
- if [[ $DEFAULT == 1 || $PHPCS == 1 ]]; then composer install; fi
- if [[ $DEFAULT == 1 ]]; then composer run-script post-install-cmd --no-interaction; fi

- if [[ $CHECKS == 1 ]]; then composer stan-setup; fi
- if [[ $PHPSTAN == 1 ]]; then composer require --dev phpstan/phpstan-shim:^0.11; fi

script:
- if [[ $DEFAULT == 1 ]]; then composer test; fi

- if [[ $CHECKS == 1 ]]; then composer cs-check; fi
- if [[ $CHECKS == 1 ]]; then composer stan; fi
- if [[ $DEFAULT == 1 ]]; then vendor/bin/phpunit; fi
- if [[ $PHPCS == 1 ]]; then composer cs-check; fi
- if [[ $PHPSTAN == 1 ]]; then vendor/bin/phpstan analyse src/; fi

cache:
directories:
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@

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

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

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

## Installation

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

If Composer is installed globally, run

```bash
composer create-project --prefer-dist cakephp/app
composer create-project --prefer-dist --stability=dev cakephp/app:4.x
```

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

```bash
composer create-project --prefer-dist cakephp/app myapp
composer create-project --prefer-dist --stability=dev cakephp/app:4.x myapp
```

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

## Configuration

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

## Layout

The app skeleton uses a subset of [Foundation](http://foundation.zurb.com/) (v5) CSS
The app skeleton uses [Milligram](https://milligram.io/) (v1.3) minimalist CSS
framework by default. You can, however, replace it with any other library or
custom styles.
23 changes: 12 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.6",
"cakephp/cakephp": "3.8.*",
"cakephp/migrations": "^2.0.0",
"php": ">=7.2",
"cakephp/cakephp": "^4.0",
"cakephp/migrations": "3.0.0-beta1",
"cakephp/plugin-installer": "^1.0",
"mobiledetect/mobiledetectlib": "2.*"
},
"require-dev": {
"cakephp/bake": "^1.9.0",
"cakephp/cakephp-codesniffer": "^3.0",
"cakephp/debug_kit": "^3.17.0",
"cakephp/bake": "^4.0",
"cakephp/cakephp-codesniffer": "dev-next",
"cakephp/debug_kit": "^4.0",
"josegonzalez/dotenv": "3.*",
"phpunit/phpunit": "^5|^6",
"phpunit/phpunit": "^8.0",
"psy/psysh": "@stable"
},
"suggest": {
Expand All @@ -42,14 +42,15 @@
"@test",
"@cs-check"
],
"cs-check": "phpcs --colors -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/ config/ webroot/",
"cs-fix": "phpcbf --colors -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/ config/ webroot/",
"stan": "phpstan analyse -l 5 src/",
"cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
"cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
"stan": "phpstan analyse src/",
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan-shim:^0.11 && mv composer.backup composer.json",
"test": "phpunit --colors=always"
},
"prefer-stable": true,
"config": {
"sort-packages": true
}
},
"minimum-stability": "dev"
}
59 changes: 28 additions & 31 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
'jsBaseUrl' => 'js/',
'paths' => [
'plugins' => [ROOT . DS . 'plugins' . DS],
'templates' => [APP . 'Template' . DS],
'locales' => [APP . 'Locale' . DS],
'templates' => [ROOT . DS . 'templates' . DS],
'locales' => [RESOURCES . 'locales' . DS],
],
],

Expand Down Expand Up @@ -111,7 +111,7 @@
'_cake_core_' => [
'className' => FileEngine::class,
'prefix' => 'myapp_cake_core_',
'path' => CACHE . 'persistent/',
'path' => CACHE . 'persistent' . DS,
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKECORE_URL', null),
Expand All @@ -126,7 +126,7 @@
'_cake_model_' => [
'className' => FileEngine::class,
'prefix' => 'myapp_cake_model_',
'path' => CACHE . 'models/',
'path' => CACHE . 'models' . DS,
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKEMODEL_URL', null),
Expand Down Expand Up @@ -259,28 +259,32 @@
* other RDBMS.
*/
'Datasources' => [
/**
* These configurations should contain permanent settings used
* by all environments.
*
* The values in app_local.php will override any values set here
* and should be used for local and per-environment configurations.
*
* Environment variable based configurations can be loaded here or
* in app_local.php depending on the applications needs.
*/
'default' => [
'className' => Connection::class,
'driver' => Mysql::class,
'persistent' => false,
'host' => 'localhost',
/*
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
//'port' => 'non_standard_port_number',
/*
* It is recommended to set these options through your environment or app_local.php
*/
//'username' => 'my_app',
//'password' => 'secret',
//'database' => 'my_app',
/*
* You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6).
'timezone' => 'UTC',

/**
* For MariaDB/MySQL the internal default changed from utf8 to utf8mb4, aka full utf-8 support, in CakePHP 3.6
*/
//'encoding' => 'utf8mb4',
'timezone' => 'UTC',

/**
* If your MySQL server is configured with `skip-character-set-client-handshake`
* then you MUST use the `flags` config to set your charset encoding.
* For e.g. `'flags' => [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4']`
*/
'flags' => [],
'cacheMetadata' => true,
'log' => false,
Expand All @@ -303,8 +307,6 @@
* which is the recommended value in production environments
*/
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],

'url' => env('DATABASE_URL', null),
],

/*
Expand All @@ -314,18 +316,13 @@
'className' => Connection::class,
'driver' => Mysql::class,
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'my_app',
'password' => 'secret',
'database' => 'test_myapp',
//'encoding' => 'utf8mb4',
'timezone' => 'UTC',
//'encoding' => 'utf8mb4',
'flags' => [],
'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_TEST_URL', null),
],
],

Expand Down Expand Up @@ -368,8 +365,8 @@
*
* ## Options
*
* - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'. Avoid using `.` in cookie names,
* as PHP will drop sessions from cookies with `.` in the name.
* - `cookie` - The name of the cookie to use. Defaults to value set for `session.name` php.ini config.
* Avoid using `.` in cookie names, as PHP will drop sessions from cookies with `.` in the name.
* - `cookiePath` - The url path for which session cookie is set. Maps to the
* `session.cookie_path` php.ini config. Defaults to base path of app.
* - `timeout` - The time in minutes the session should be valid for.
Expand Down
24 changes: 23 additions & 1 deletion config/app_local.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,34 @@
* the following line and set the port accordingly
*/
//'port' => 'non_standard_port_number',

'username' => 'my_app',
'password' => 'secret',

'database' => 'my_app',
'log' => true,
/**
* If not using the default 'public' schema with the PostgreSQL driver
* set it here.
*/
//'schema' => 'myapp',

/**
* You can use a DSN string to set the entire configuration
*/
'url' => env('DATABASE_URL', null),
],

/*
* The test connection is used during the test suite.
*/
'test' => [
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'my_app',
'password' => 'secret',
'database' => 'test_myapp',
//'schema' => 'myapp',
],
],

/*
Expand Down
Loading

0 comments on commit 3d543a0

Please sign in to comment.