0
Compose all the things                             @philsturgeonTuesday, 26 February 13
Derp derpy derp!                   Kapture              PHP The Right Way                   PyroCMS              PHP Town ...
“I could spend 10 minutes            writing some code, but [stuff]            that, I can just install a Gem.”           ...
Ruby Gems                          Warden - Simple generic authentication                          OmniAuth - Integrate Fa...
Python (PIP)                          Requests - THE HTTP class                          PIL - Image Manipulation (but doe...
Tuesday, 26 February 13
Tuesday, 26 February 13
What about PHP?Tuesday, 26 February 13
Tuesday, 26 February 13
Tuesday, 26 February 13
Tuesday, 26 February 13
Installing stuff with PEAR         sudo apt-get install php-pear php5-dev         sudo pear channel-discover pear.phpunit....
Cool story broTuesday, 26 February 13
“Active Package”Tuesday, 26 February 13
“Modern Package”Tuesday, 26 February 13
Tuesday, 26 February 13
Tuesday, 26 February 13
Tuesday, 26 February 13
Tuesday, 26 February 13
The Dawn of Frameworks!Tuesday, 26 February 13
Tuesday, 26 February 13
Tuesday, 26 February 13
Tuesday, 26 February 13
Write ALL THE CODE                                       CodeIgniter                          DATABAZE!!            Encryp...
Tuesday, 26 February 13
Tuesday, 26 February 13
Write ALL THE CODE                      Kohana       CodeIgniter                      Benchmarking                       O...
Write ALL THE CODE                      Kohana      CodeIgniter                      Benchmarking                       OR...
Write ALL THE CODE                      Kohana     CodeIgniter                      Benchmarking                       ORM...
FW Packages = Solution?                          CodeIgniter: Sparks                          FuelPHP: Cells              ...
codeigniter-oauth2                             fuel-oauth2                            laravel-oauth2Tuesday, 26 February 13
Tuesday, 26 February 13
Tuesday, 26 February 13
Composer Setup                      $ mkdir playground                      $ cd playground                      $ curl -s...
Require Packages                      {                          "minimum-stability": "beta",                          "re...
Install those Packages                      $ ./composer.phar install                      Loading composer repositories w...
Other Repos     {         "repositories": [             { "type": "vcs", "url": "http://github.com/mycompany/privaterepo" ...
Tuesday, 26 February 13
Why not just use them?                          Boilerplate makes kittens cry                          Service Providers +...
Tuesday, 26 February 13
Tuesday, 26 February 13
Where is Laravel 4                          https://github.com/laravel/framework          https://github.com/laravel/larav...
Cloning Laravel 4                 $ git clone git://github.com/laravel/laravel.git                 -o laravel -b develop p...
Install Dependencies                 $ cd playground                 $ curl -s https://getcomposer.org/installer | php    ...
Building a Package             $ php artisan workbench             What is vendor name of the package?Epic             Wha...
Understanding StructureTuesday, 26 February 13
Workbench Structure                    workbench                        epic                             unicorn          ...
Metadata                    {                     "name": "epic/unicorn",                     "authors": [                ...
Unit-tests                              phpunit.de                             travis-ci.orgTuesday, 26 February 13
.travis.yml                    language: php                    php:                      - 5.3                      - 5.4...
PSR-WAT?                          PHP Standard Recommendation                          PHP-FIG: Framework Interoperability...
PSR-0                          Autoloading Standard                    <Vendor Name>(<Namespace>)*<Class Name>            ...
PSR-1                          Basic Coding Standard                    Files are UTF-8                    Definition OR si...
PSR-2                          Coding Style Guide                    SHOULD limit to 80 or 120 characters per line        ...
Should you PSR-2?                    PSR-0 and PSR-1 are no brainers                    PSR-2 was split from PSR-1 as its ...
codeigniter-oauth2                             fuel-oauth2                            laravel-oauth2Tuesday, 26 February 13
Interfaces for the WinTuesday, 26 February 13
Framework Driver Basics                    interface SessionInterface {                        public function getKey();  ...
Framework Driver Basics    class NativeSession implements SessionInterface    use CI_Session as Session;    class CISessio...
Framework Driver Basics      use CI_Session as Session;      class CISession implements SessionInterface      {          p...
Framework Driver Basics            public function put($value)            {              $this->store->set_userdata(      ...
Tuesday, 26 February 13
PyroCMS                    PyroCMS 2.2 = PHP 5.2 + CodeIgniter                    PyroCMS 2.3 = PHP 5.3 + Composer + CodeI...
PyroCMS Depenencies                             dflydev/markdown                             dhorrigan/capsule             ...
Any Questions?                          What was that thing you said about PSR?                          Are you Australia...
Thank You                              @philsturgeon                            philsturgeon.co.uk                        ...
Upcoming SlideShare
Loading in...5
×

Laravel and Composer

7,194

Published on

Composer is moving over to use Laravel, which requires command line stuff and a bunch of new thinking as to how code is managed. Also, my bundles have vanished, and now we're using camelCase instead of snake_case? Sit down for a history lesson about why packages have always been a mess, why frameworks have been the way they were and why they're changing in this "PHP Renaissance" to use awesome new tools like Composer.

0 Comments
17 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,194
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
176
Comments
0
Likes
17
Embeds 0
No embeds

No notes for slide

Transcript of "Laravel and Composer"

  1. 1. Compose all the things @philsturgeonTuesday, 26 February 13
  2. 2. Derp derpy derp! Kapture PHP The Right Way PyroCMS PHP Town Hall CodeIgniter PHP-FIG FuelPHP I have a weird accent PancakeApp @philsturgeonTuesday, 26 February 13
  3. 3. “I could spend 10 minutes writing some code, but [stuff] that, I can just install a Gem.” -- Elliott Kember, RiotHQTuesday, 26 February 13
  4. 4. Ruby Gems Warden - Simple generic authentication OmniAuth - Integrate Facebook, Twitter, etc OAuth / OAuth 2 - Go-to gems for oauth Thor or Clam - Command line frameworks ActiveRecord - THE ORM for RubyTuesday, 26 February 13
  5. 5. Python (PIP) Requests - THE HTTP class PIL - Image Manipulation (but doesnt suck) UJSON - UTF-8 support + way faster Flask - RESTful micro-framework PyYAML - Quick YAML parserTuesday, 26 February 13
  6. 6. Tuesday, 26 February 13
  7. 7. Tuesday, 26 February 13
  8. 8. What about PHP?Tuesday, 26 February 13
  9. 9. Tuesday, 26 February 13
  10. 10. Tuesday, 26 February 13
  11. 11. Tuesday, 26 February 13
  12. 12. Installing stuff with PEAR sudo apt-get install php-pear php5-dev sudo pear channel-discover pear.phpunit.de sudo pear install phpunit/PHPUnitTuesday, 26 February 13
  13. 13. Cool story broTuesday, 26 February 13
  14. 14. “Active Package”Tuesday, 26 February 13
  15. 15. “Modern Package”Tuesday, 26 February 13
  16. 16. Tuesday, 26 February 13
  17. 17. Tuesday, 26 February 13
  18. 18. Tuesday, 26 February 13
  19. 19. Tuesday, 26 February 13
  20. 20. The Dawn of Frameworks!Tuesday, 26 February 13
  21. 21. Tuesday, 26 February 13
  22. 22. Tuesday, 26 February 13
  23. 23. Tuesday, 26 February 13
  24. 24. Write ALL THE CODE CodeIgniter DATABAZE!! Encryption Benchmarking Uploads Cache Image Manipulation Calender Language Email Pagination Shopping Cart? SecurityTuesday, 26 February 13
  25. 25. Tuesday, 26 February 13
  26. 26. Tuesday, 26 February 13
  27. 27. Write ALL THE CODE Kohana CodeIgniter Benchmarking ORM Encryption HTTP Cache Uploads UTF-8 Calender Image Manipulation Templates HMVC Cart Language Driver Pagination Email SecurityTuesday, 26 February 13
  28. 28. Write ALL THE CODE Kohana CodeIgniter Benchmarking ORM Encryption FuelPHP HTTP Cache REST Uploads UTF-8 Scaffolding Calender Image Manipulation Templates Migrations HMVC Cart Auth Language Driver More Mongo Pagination Email SecurityTuesday, 26 February 13
  29. 29. Write ALL THE CODE Kohana CodeIgniter Benchmarking ORM Encryption FuelPHP HTTP Cache REST Uploads UTF-8 Scaffolding Calender Image Manipulation Templates Migrations Laravel 3 HMVC Cart Auth Language Routes Epic Driver More Mongo CALLBACKS Pagination IoC Email Security BundlesTuesday, 26 February 13
  30. 30. FW Packages = Solution? CodeIgniter: Sparks FuelPHP: Cells Laravel 3: BundlesTuesday, 26 February 13
  31. 31. codeigniter-oauth2 fuel-oauth2 laravel-oauth2Tuesday, 26 February 13
  32. 32. Tuesday, 26 February 13
  33. 33. Tuesday, 26 February 13
  34. 34. Composer Setup $ mkdir playground $ cd playground $ curl -s https://getcomposer.org/installer | php $ ls composer.phar $ vim composer.jsonTuesday, 26 February 13
  35. 35. Require Packages { "minimum-stability": "beta", "require": { "dflydev/markdown": "1.0.*", "illuminate/database": "*" } }Tuesday, 26 February 13
  36. 36. Install those Packages $ ./composer.phar install Loading composer repositories with package information Installing dependencies - Installing dflydev/markdown (v1.0.2) Downloading: 100% ....... and so onTuesday, 26 February 13
  37. 37. Other Repos { "repositories": [ { "type": "vcs", "url": "http://github.com/mycompany/privaterepo" }, { "type": "vcs", "url": "http://svn.example.org/private/repo" }, { "type": "vcs", "url": "http://github.com/mycompany/privaterepo2" } ], "require": { "company/package": "*", "company/package2": "*", "company/package3": "2.0.0" }}Tuesday, 26 February 13
  38. 38. Tuesday, 26 February 13
  39. 39. Why not just use them? Boilerplate makes kittens cry Service Providers + Facade avoid boilerplate IoC is SIMPLE + Controller integration Lowest barrier to entryTuesday, 26 February 13
  40. 40. Tuesday, 26 February 13
  41. 41. Tuesday, 26 February 13
  42. 42. Where is Laravel 4 https://github.com/laravel/framework https://github.com/laravel/laravel/tree/develop https://github.com/illuminateTuesday, 26 February 13
  43. 43. Cloning Laravel 4 $ git clone git://github.com/laravel/laravel.git -o laravel -b develop playgroundTuesday, 26 February 13
  44. 44. Install Dependencies $ cd playground $ curl -s https://getcomposer.org/installer | php $ ./composer.phar installTuesday, 26 February 13
  45. 45. Building a Package $ php artisan workbench What is vendor name of the package?Epic What is the package name?Unicorn What is your name?Phil Sturgeon What is your e-mail address? email@philsturgeon.co.ukTuesday, 26 February 13
  46. 46. Understanding StructureTuesday, 26 February 13
  47. 47. Workbench Structure workbench epic unicorn .travis.yml composer.json phpunit.xml public src Epic Unicorn UnicornServiceProvider.php config lang migrations views testsTuesday, 26 February 13
  48. 48. Metadata { "name": "epic/unicorn", "authors": [ { "name": "Phil Sturgeon", "email": "email@philsturgeon.co.uk" } ], "require": { "php": ">=5.3.0", "illuminate/support": "4.0.x" }, "autoload": { "classmap": [ "src/migrations" ], "psr-0": { "EpicUnicorn": "src/" } }, "minimum-stability": "dev" }Tuesday, 26 February 13
  49. 49. Unit-tests phpunit.de travis-ci.orgTuesday, 26 February 13
  50. 50. .travis.yml language: php php: - 5.3 - 5.4 before_script: - curl -s http://getcomposer.org/installer | php - php composer.phar install --dev script: phpunitTuesday, 26 February 13
  51. 51. PSR-WAT? PHP Standard Recommendation PHP-FIG: Framework Interoperability Group Website: php-fig.org Drupal, Joomla, phpBB, Symfony2, PyroCMS, FLOW, Lithium, Zend Framework, AWS SDK, CakePHP, Doctrine, PEAR, Propel, Zikula, others... Hopefully Laravel soon.Tuesday, 26 February 13
  52. 52. PSR-0 Autoloading Standard <Vendor Name>(<Namespace>)*<Class Name> Classes Session_Cache is Session/Cache.php Must have a top-level namespace http://bit.ly/PSR-0Tuesday, 26 February 13
  53. 53. PSR-1 Basic Coding Standard Files are UTF-8 Definition OR side-effect Constants are upper-case Class names are StudlyCaps Method names camelCase() http://bit.ly/PSR-oneTuesday, 26 February 13
  54. 54. PSR-2 Coding Style Guide SHOULD limit to 80 or 120 characters per line All PHP files MUST use the Unix LF (linefeed) line ending. The closing ?> tag MUST be omitted from files containing only PHP. MUST use 4 spaces for indentation, not tabs http://bit.ly/PSR-2Tuesday, 26 February 13
  55. 55. Should you PSR-2? PSR-0 and PSR-1 are no brainers PSR-2 was split from PSR-1 as its controversial Tabs v Spaces? I don’t care. Laravel is PSR-2ishTuesday, 26 February 13
  56. 56. codeigniter-oauth2 fuel-oauth2 laravel-oauth2Tuesday, 26 February 13
  57. 57. Interfaces for the WinTuesday, 26 February 13
  58. 58. Framework Driver Basics interface SessionInterface { public function getKey(); public function put($value); public function get(); public function forget(); }Tuesday, 26 February 13
  59. 59. Framework Driver Basics class NativeSession implements SessionInterface use CI_Session as Session; class CISession implements SessionInterface use FuelCoreSession_Driver as Session; class FuelPHPSession implements SessionInterface use IlluminateSessionStore as SessionStore; class IlluminateSession implements SessionInterfaceTuesday, 26 February 13
  60. 60. Framework Driver Basics use CI_Session as Session; class CISession implements SessionInterface { public function __construct(Session $store) { $this->store = $store; } }Tuesday, 26 February 13
  61. 61. Framework Driver Basics public function put($value) { $this->store->set_userdata( $this->getkey(), serialize($value) ); } public function forget() { $this->store->unset_userdata( $this->getKey() ); }Tuesday, 26 February 13
  62. 62. Tuesday, 26 February 13
  63. 63. PyroCMS PyroCMS 2.2 = PHP 5.2 + CodeIgniter PyroCMS 2.3 = PHP 5.3 + Composer + CodeIgniter PyroCMS 3.0 = PHP 5.3 + Composer + LaravelTuesday, 26 February 13
  64. 64. PyroCMS Depenencies dflydev/markdown dhorrigan/capsule ircmaxell/password-compat illuminate/database nesbot/Carbon quick/cache simplepie/simplepie tijsverkoyen/akismetTuesday, 26 February 13
  65. 65. Any Questions? What was that thing you said about PSR? Are you Australian? Is camelCase web-scale? Do you prefer Tabs or Spaces? Why doesn’t PyroCMS support MongoDB?Tuesday, 26 February 13
  66. 66. Thank You @philsturgeon philsturgeon.co.uk github.com/philsturgeonTuesday, 26 February 13
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×