24
Composer, Guzzle, Symfony finder Drupal 7

Guzzle Drupal 7

Embed Size (px)

Citation preview

Composer, Guzzle,

Symfony finder Drupal 7

NORTHPOINT DIGITAL HELPS OPTIMIZE YOUR DIGITAL PRESENCE THROUGH THE PERFECT BLEND OF STRATEGY, EXPERIENCE AND TECHNOLOGY

WE CREATE DIGITAL PLATFORMS SO YOU HAVE ENDLESS POSSIBILITIES ACROSS MOBILE, SOCIAL AND WEB

OUR CLIENTS Below are a few of the companies we have helped succeed in the digital arena.

NorthPoint Digital is headquartered in New York with offices throughout the North East.

LOCATIONS

NEW YORK BOSTON PHILADELPHIA

Composer, Guzzle,

Symfony finder Drupal 7

PHP is a huge project.

But how big are we, really?

h"p://bit.ly/trends-­‐langs-­‐web  

PHP consists of a lot of successful but extremely

isolated libraries (see WordPress, Drupal, Symfony, Zend, and others)

h"p://bit.ly/trends-­‐php-­‐groups  

Before Composer 1.  How do you autoload PHP Classes from external libraries

Autoloading is the background machine that makes it possible to reference php classes without using require or include statements.

2. Dependencies Dependencies mean another library or libraries to download and configure.

3. Where to store the downloaded library(ies) in the project? Commit the whole thing or only part of it?

Composer is a executable file https://getcomposer.org/download/

Composer itself is just an executable file

If you see any errors or warnings during

the download step you may need to tweak your php configuration.

You only need to tweak your php configurations on your development machine since Composer is not run on production

nor does composer.phar need to be included in your repo

Composer's main job is to download third party libraries into the

vendor directory of your project

To tell composer the libraries your project needs, you need to create a

composer.json file

We are going to use Composer to easily bring

Guzzle and Symfony/finder(time permitting)

into a Drupal project

php composer.phar shows the list of all available composer commands

Instead of creating the composer.json file by hand, we can use a composer command:

php composer.phar init

For the first set of questions, unless you're planning on open-sourcing

your project, you don't have to worry about your answers.

Define Dependencies

Which third party libraries you want to include in your project

https://packagist.org/packages/guzzlehttp/guzzle

https://packagist.org/packages/symfony/finder

A package is just a third party directory that you want to download into your project

https://packagist.org/

Composer is searching for these libraries from packagist, a giant central repository of packages.

php composer.phar init

php composer.phar install

Include the vendor/autoload.php file somewhere in your project.

require  DRUPAL_ROOT  .  '/vendor/autoload.php';  

New York Office 130 West 42nd StreetNew York, NY 10036Tel: 212-819-1700

Boston Office 470 Atlantic Avenue Boston, MA 02110Tel: 617-725-8888

Philadelphia Office 1650 Market StreetPhiladelphia, PA 19103Tel: 215-558-2700

[email protected]    /  www.northpointdigital.com  /  @northps  

Thank you

Eric Sod @EricSod

NorthPoint Digital [email protected]

http://ericsod.net/ https://github.com/esod