Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Composer and CakePHP

Composer and CakePHP

Development is better with package managers

Justin Yost

August 23, 2014
Tweet

More Decks by Justin Yost

Other Decks in Programming

Transcript

  1. Composer and CakePHP Development is better with package managers Justin

    Yost Developer at Loadsys —twitter.com/jtyost2 —github.com/jtyost2 —yostivanich.com
  2. What is Composer —Composer is a modern PHP Dependency Management

    Tool —Ensures everyone is using the same version of a tool —Think Git-Submodules but better and more awesome —Similar to bundler or npm
  3. What Composer Solves —We need this PEAR package, CakePHP Plugin,

    Version Controller Package, Cake 2.4+ —We need to ensure that the versions for everything all match and we aren't missing any dependencies —Composer installs pretty much anything
  4. Composer and CakePHP 2.4+ —We can install CakePHP 2.4+ using

    Composer —Rest of this is in the book, thanks to the community: —http://book.cakephp.org/2.0/en/installation/ advanced-installation.html
  5. Composer and CakePHP 3.0 —CakePHP 3.0 is super easy to

    get running with Composer composer create-project --prefer-dist -s dev cakephp/app ./install-dir —Creates a new CakePHP 3.0 application with everything running right away
  6. Composer and CakePHP Plugins —Git submodules are ugly and a

    pain to ensure they get updated properly —Composer solves this really well: —Composer knows how to install and load plugins for: —CakePHP, WordPress, Symfony, Drupal, Zend, etc
  7. Using Composer for Yourself —Super Easy to use Composer for

    your own stuff —Composer makes it easier for both your own team and the community to use your tools and plugins
  8. Where should you use Composer —Everywhere you have a dependency

    as part of your PHP projects —Everywhere you have a shared PHP project —Everywhere you have a shared project geared towards PHP —So much better than PEAR
  9. What all can Composer do? —It doesn't have to be

    PHP —Loadsys has a suite of shell scripts managed via Composer —github.com/loadsys/CakePHP-Shell-Scripts
  10. What all can Composer do? —It doesn't have to be

    public facing —Composer will hook into private repositories —Code
  11. What all can Composer do? —The project doesn't even have

    to use Composer itself —Composer will install Git/SVN/Mercurial/Pear backed projects by itself —Code
  12. What all can Composer do? composer create-project —create-project is pretty

    unique to Composer —Clones a package, installs dependencies and run scripts for setup, etc
  13. Packagist —Packagist is a repository of Composer Packages for the

    PHP Community —Packagist is open source and you can add your own packages
  14. Satis —Static version of Packagist —Use for hosting internal packages

    —I want this package to be easy to find and deploy but not public
  15. Satis as a proxy to Packagist —Using Satis this way

    solves some real problems with Composer —Since most of the time packages are backed by Github API limits can be a real problem —You can instead do composer installs from your Satis server and not deal with Github
  16. Upgrade Your Development Process —Composer will make your projects easier

    to manage —Composer will make dependencies less of a hassle —Composer will make deployments simpler and easier
  17. Final Thoughts —We should all be using Composer —Even if

    you never publish a Composer backed Plugin you will gain from using Composer for your projects —Thanks, Cake Core Team for making Composer work great with CakePHP 3.0