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

Composer Introduction - PHP Practice

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

Composer Introduction - PHP Practice

Composer library introduction with developer description with library code.

Avatar for Vallabh Kansagara

Vallabh Kansagara

January 12, 2016
Tweet

Other Decks in Technology

Transcript

  1. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level PHP Practice Vallabh Kansagara Jr. Consultant KNOWARTH Technologies Pvt. Ltd.
  2. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Your Presenter 2 Vallabh Kansagara (@VRKANSAGARA) http://www.vrkansagara.in [email protected] [email protected]
  3. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. 3 Dependency Manager for PHP Topic
  4. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Composer is a tool for dependency management in PHP. It allows you to declare the libraries and manage them for you. 4 Definitions: What is a “Composer”?
  5. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why composer ? 5 ➢ Lightweight Tool. ➢ Widely used by Open Source Application. ➢ Effortless dependency manager for individual project. ➢ Developer just love this tools.
  6. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 6 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git How to get composer? 1. curl -sS https://getcomposer.org/installer | php 2. php -r "readfile('https://getcomposer.org/installer');" | php
  7. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 7 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git How run composer? Use php composer.phar from command line. php composer.phar
  8. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 8 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Prerequisites for composer . Composer.json file in working directory. Keyword Library name Library version
  9. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 9 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git How to get library list ? Get package name from the https://packagist.org/
  10. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 10 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git How to install dependency? To install project dependency. Just run php composer.phar install from project directory. After installation there are folder and files are bellow.
  11. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 11 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer files and folder overview. Library root directory Composer itself dependant library. Rest of dependant library list. Composer bootstrapping file. Composer library list file. Composer library lock file.
  12. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 12 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar self-update OR php composer.phar selfupdate This command will update the composer composer.phar file.
  13. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 13 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar init Initialisation of composer.
  14. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 14 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar install Install all dependency listed in composer.json file. Also install dependant dependency of library.
  15. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 15 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar remove Remove library from the composer list and library folder.
  16. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 16 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar require Install library using composer command. No need to manually edit the composer.json file.
  17. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 17 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar update This will update the library version as per composer.json file. This is handy place to update the library version and update as per required.
  18. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 18 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar validate This will validate the composer.json file. This is really helpful command when you have many libraries in composer library.
  19. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 19 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar dumpautoload / dump-autoload
  20. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 20 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. Composer dump-autoload in details. { "autoload": { Keyword "classmap": [ Class path. "classes" Folder name of class path. ], "psr-4": { PHP Standard for autoloading. "App\\": "app/" Register namespace for folder. } },
  21. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 21 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Composer in day to day usage. php composer.phar clear-cache OR php composer.phar clearcache This will clears composer's internal package cache(s).
  22. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level © 2015 KNOWARTH Technologies Pvt. Ltd. Why Docker? 22 ➢ Docker allows applications to be isolated into containers with instructions for exactly what they need to survive that can be easily ported from machine to machine. ➢ Virtual machines also allow the exact same thing, and numerous other tools like Chef and Puppet already exist to make rebuilding these configurations portable and reproducible. ➢ While Docker has a more simplified structure compared to both of these, the real area where it causes disruption is resource efficiency. ➢ Faster delivery of your applications a) WordPress b) Drupal c) Liferay ❖ Deploy and scale more easily a) Jenkins b) Bamboo c) Git Who are using composer library?
  23. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level Questions?
  24. SLIDE TITLE ▪ Click to edit Master text styles ▪

    Second level ▪ Third level ▪ Fourth level ▪ Fifth level THANK YOU Email: [email protected]