Composer | PHP Dependency Manager

60 %
40 %
Information about Composer | PHP Dependency Manager
Technology

Published on March 8, 2014

Author: ujjwal-ojha

Source: slideshare.net

Description

A quick start presentation on Composer, PHP dependency manager

COMPOSER A PHP dependency manager

Who am I? • Ujjwal Ojha • BSc. CSIT • Hrevert Technologies • Web application development

Table Of Contents • Introduction • What is dependency? • Why not Pear? • Installation • Basic Usage

Introduction • PHP dependency manager • Very useful to work with third party libraries • Similar to npm for node.js, Bundler for Ruby, or pip for Python

What is dependency?

Recursive Dependencies

Two Way Recursive Dependencies

Why not Pear? • Pears installs packages globally • With Pear, your code is scattered throughout the machine.

Installation mkdir myprojectname cd myprojectname curl -s https://getcomposer.org/installer | php

Create composer.json { "require": { "silex/silex": "~1.0" } } php composer.phar install

Loading composer repositories with package information Installing dependencies - Installing psr/log (1.0.0) Loading from cache - Installing symfony/routing (v2.2.1) Downloading: 100% - Installing symfony/http-foundation (v2.2.1) Downloading: 100% - Installing symfony/event-dispatcher (v2.2.1) Loading from cache - Installing symfony/http-kernel (v2.2.1) Downloading: 100% - Installing pimple/pimple (v1.0.2) Downloading: 100% - Installing silex/silex (v1.0.0) Downloading: 100% Writing lock file Generating autoload files Your dependencies dependency Your dependency

Autoloading Composer generates an autoload file for all your Dependencies

Autoloader Supports PSR-0 Autoloader PSR-4 Autoloader Classmap Autoloader

Autoloader usage <?php // From your app`s bootstrap.php include “vendor/autoload.php”;

Scripts Perform custom actions during installation and update "scripts": { "post-install-cmd": [ "Sensio...ComposerScriptHandler::buildBootstrap", "Sensio...ComposerScriptHandler::clearCache", "Sensio...ComposerScriptHandler::installAssets", "Sensio...ComposerScriptHandler::installRequirementsFile " ], "post-update-cmd": [ “Sensio...ComposerScriptHandler::buildBootstrap", "Sensio...ComposerScriptHandler::clearCache", "Sensio...ComposerScriptHandler::installAssets", "Sensio...ComposerScriptHandler::installRequirementsFile " ] },

Non-composer packages { "repositories": [ { "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "dist": { "url": "http://www.smarty.net/files/Smarty-3.1.7.zip", "type": "zip" }, "source": { "url": "http://smarty-php.googlecode.com/svn/", "type": "svn" } } } ] }

Private dependencies with Satis { "repositories": [ { "type": "composer", "url": "http://packages.example.org/" } ], "require": { "company/package": "1.2.0", "company/package2": “1.5.2", } }

Thank You Questions? Ujjwal Ojha

Add a comment

Related presentations

Related pages

Composer

Dependency Management for PHP. Dependency Manager for PHP Getting Started Download. Documentation Browse Packages
Read more

Composer – Wikipedia

Composer steht für. Composer, eine Paketverwaltung für PHP; KompoZer (früher Composer), ein HTML-Editor (Nachfolger von Nvu) Siehe auch. Liste aller ...
Read more

Composer

Dependency Management for PHP ... Download Composer. Run this in your terminal to get the latest Composer version:
Read more

Composer (Paketverwaltung) – Wikipedia

Composer ist ein anwendungsorientierter Paketmanager für die Programmiersprache PHP. Das Programm steht unter der MIT-Lizenz. Composer wird über die ...
Read more

Composer - Wikipedia, the free encyclopedia

The term "composer" is often used to refer to composers of instrumental music, such as those found in classical, jazz or other forms of art and traditional ...
Read more

Map Composer Wiki - MC - Composer

Map Composer ist eine graphische Applikation in Java, um topographische Karten aus OpenStreetMap Daten zu erzeugen und deren Design zu erstellen.
Read more

Media Composer | Avid

Media Composer is the most proven video editing software in the industry, trusted by professional editors in every segment of movie making, television ...
Read more

Composer (software) - Wikipedia, the free encyclopedia

Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software ...
Read more

dict.cc | composer | Wörterbuch Englisch-Deutsch

Übersetzung für composer im Englisch-Deutsch-Wörterbuch dict.cc.
Read more

NetComposer: Startseite

NetComposer, Fullservice-Dienstleister für digitale Kommunikation. ... Social Media: Deshalb ist Facebook interessant für Ihre Firma
Read more