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

Package development for PHP and Laravel

Package development for PHP and Laravel

Things I learned and wanted to share about what steps you need to take to publish a package for every PHP developer to use. Credits to https://speakerdeck.com/mietcls for the beautiful styling!

Hannes Van De Vreken

April 30, 2014
Tweet

More Decks by Hannes Van De Vreken

Other Decks in Technology

Transcript

  1. • Full Time PHP Developer • Using Laravel since 4.0

    ~ beta 2 • Previously CodeIgniter & fuelPHP Hannes Van De Vreken
  2. • Composer & Packagist • Testing & Travis CI •

    Git tag • Documentation • Support classes for frameworks Talking about
  3. • composer self-update • composer install • composer update •

    composer search • composer require guzzle/guzzle 3.9.* • composer validate • composer list COMPOSER — USAGE ! Loading composer repositories… ! ! ./composer.json has been updated ./composer.json is valid
  4. { "autoload": { "classmap": [ "app/commands", "app/controllers", "app/filters", "app/database/migrations", "app/tests/unit/TestCase.php"

    ], "files": [ "app/helpers.php" ], "psr-0": { "Guzzle": "src/" }, "psr-4": { "GuzzleHttp\\": “src/" } } } COMPOSER — AUTOLOAD
  5. Composer dump-autoload — optimize (-o) ! — “Optimizes PSR0 packages

    to be loaded with class maps too, good for production.” COMPOSER — AUTOLOAD
  6. TRAVIS-CI - .TRAVIS.YML language: php! ! php:! - 5.3! -

    5.4! - 5.5! - hhvm! ! before_script:! - composer self-update! - composer install --prefer-source --dev! ! script: phpunit
  7. • php artisan config:publish • php artisan asset:publish • php

    artisan view:publish • php artisan migrate --package="vendor/package" LARAVEL SUPPORT
  8. • https://getcomposer.org • https://packagist.org • https://github.com/php-fig/fig-standards/tree/master/accepted • http://phpunit.de • http://www.phpspec.net

    • https://travis-ci.org/ • https://scrutinizer-ci.com/ • http://git-scm.com/docs/git-tag • http://semver.org/ • http://github.github.com/github-flavored-markdown/ • http://shields.io/ • http://laravel.com/docs/packages REFERENCE