问题
I've used composer to install CakePHP 3 while it still was in development, so the composer.json file contains dev-versions.
The composer.json file looks like this right now:
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "3.0.*-dev",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "dev-master",
"cakephp/plugin-installer": "*"
},
"require-dev": {
"d11wtq/boris": "1.0.*",
"cakephp/debug_kit": "3.0.*-dev",
"cakephp/bake": "dev-master"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"minimum-stability": "dev",
"prefer-stable": true
}
Now, what's the recommended approach for updating the application to whatever's the newest version of the CakePHP 3 library? Just updating the json-file and running composer update
?
回答1:
It depends on how strict you want to be with the versions you get. The Composer Documentation has information on all the possibilities.
What I usually do is change my cakephp/cakephp
version constraint to ~3.1.0
. This means I'll get all of the maintenance patches for Cake 3.1.x. If you want to get 3.2 when it's released, then I would change it to ~3.2.0
. I do this to have very specific control over the minor version as well.
In the end, it's your choice. You can set it up to automatically grab any new minor versions if you want to.
To update:
composer update
回答2:
in addition, you can also have a look to https://github.com/cakephp/app/blob/master/composer.json for inspiration
来源:https://stackoverflow.com/questions/32272605/whats-the-recommended-approach-for-updating-the-core-lib-of-a-cakephp3-app