Slide 1

Slide 1 text

Code Dependencies & Composer Tom J Nowell, WC Sheffield @tarendai tomjn.com

Slide 2

Slide 2 text

I’m Tom I work for Code For The People

Slide 3

Slide 3 text

This talk is about managing code frameworks, shared code, dependencies, things don’t have to be painful

Slide 4

Slide 4 text

Theme/Plugin Frameworks are born fully formed

Slide 5

Slide 5 text

Things have to be wedged into frameworks

Slide 6

Slide 6 text

We want themes and plugins to be fast and light

Slide 7

Slide 7 text

Consolidate and Grab Only What You Need

Slide 8

Slide 8 text

Modularise Things

Slide 9

Slide 9 text

These are our dependencies

Slide 10

Slide 10 text

Frameworks include everything from the get go

Slide 11

Slide 11 text

We need something like ordering off a menu

Slide 12

Slide 12 text

Enter Composer

Slide 13

Slide 13 text

Composer describes a package, and what it needs to run

Slide 14

Slide 14 text

{ “name”: “icit/wp-less”, “require”: { "php": ">=5.2.4", "leafo/lessphp": "0.4.0" } }

Slide 15

Slide 15 text

Installing Composer https://getcomposer.org/download/ ( Already installed with vvv )

Slide 16

Slide 16 text

To install dependencies > composer install

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

To update dependencies > composer update

Slide 19

Slide 19 text

Dependencies get put in a vendor/ folder An autoloader is provided so there are no require/includes

Slide 20

Slide 20 text

Packagist The PHP world has a headstart on us

Slide 21

Slide 21 text

For packages not on Packagist { "repositories": [ { "type": "git", "url": "https://github.com/leafo/lessphp.git" } ], ...etc... }

Slide 22

Slide 22 text

Questions? Tom J Nowell tomjn.com @tarendai