Require composer - markstory/cakephp GitHub Wiki

As an expansion to Using composer it would be beneficial to CakePHP to require composer in 3.x. Doing so has a few benefits:

  • All setups/installations are consistent.
  • CakePHP doesn't have to duplicate features that composer provides.
  • Features like App::build() and Plugin::load() become un-necessary making CakePHP simpler.
  • cake bake project just becomes an alias for composer commands.
  • We can remove the skel directory.

Features to remove

  • Cake\Core\ClassLoader
  • App::build() paths will no longer need to be loaded.
  • Plugin::unload() would not be needed.
  • Plugin::load() would simply load bootstrap + routes files.

Separate repositories for framework & app skeleton

In order to facilitate the use of composer the app and framework packages would be split. One new repository would be required.

App skeleton

The app skeleton would contain the the App/ dir from the current combined repository. This new repository would come with the current homepage, and half complete configuration it does today. This repository would be available at cakephp/cakephp-app.

Framework repo

The present cakephp/cakephp repository would be modified to only contain the contents of lib/. Other current top-level files like build.xml, README, CONTRIBUTING etc. would be moved into the new root directory. The index.php file would be removed. Retaining the existing repository name is important for github rankings and developer awareness. Documentation and the current composer.json file would need modifications for naming and guidance on how to start a new CakePHP application.

Starting a new project

New projects can be created either using composer or using an existing cakephp application.

# Using composer
$ php composer.phar create-project cakephp/cakephp-app

# Using an existing app
$ Console/cake bake project <path to project>

Project bake would generally be a proxy for the equivalent composer command.

Installing plugins

Plugins should continue to use the composer/installers package and set their type to cakephp-plugin. This will result in them being installed into the Plugin/ directory as they always have. Generally plugins should be installed with composer.

Public plugins

Public open source plugins can easily be registered with http://packagist.org and be installed using composer. Alternatively, when work is complete on plugins.cakephp.org people could use that as a package index for installing plugins.

Installing private plugins

Private plugins are quite common and need to be accommodated, and their use documented in the CakePHP docs. Presently composer supports installing packages from git. Suggested ways to install private plugins would include:

  • Using composer + git
  • Using git submodules and modifying the application's composer.json file to autoload plugin files correctly.
  • Using a private satis instance.

All in one distributions

At each release we can make a new zip file that contains the following:

  • App skeleton.
  • composer.phar
  • App dependencies pre-installed.

This zip file can be uploaded to the github release page for people to use. It could also be uploaded to cakephp.org and linked to from the website.

Generating this package file will be automated with phing or a similar tool.