Slide 1

Slide 1 text

Why Puli? Titouan Galopin SensioLabs University 1

Slide 2

Slide 2 text

About Titouan Galopin Puli core contributor puli.js lead developer @tgalopin // titouangalopin.com 2

Slide 3

Slide 3 text

Why this talk? 3

Slide 4

Slide 4 text

Agenda I. What’s Puli? II. How to use Puli in your application? III. Status of Puli and what’s coming in 2016 4

Slide 5

Slide 5 text

I. What’s Puli? 5

Slide 6

Slide 6 text

Currently in Packagist Libraries Symfony bundles Drupal modules Zend Framework modules Laravel packages What’s Puli? 6

Slide 7

Slide 7 text

All framework extensions do the same things What’s Puli? 7

Slide 8

Slide 8 text

Ideal world Libraries ✓ Symfony bundles Drupal modules Zend Framework modules Laravel packages What’s Puli? 8

Slide 9

Slide 9 text

Why do we need framework extensions? What’s Puli? 9

Slide 10

Slide 10 text

What’s Puli? Application FOSUserBundle login.html.twig To simplify access to resources Before: return $this->render( __DIR__ . ‘/../../vendor/ friendsofsymfony/user- bundle/Resources/views/Security/index.html. twig’ ); After: return $this->render( ‘FOSUserBundle:Security:login.html.twig’ ); 10

Slide 11

Slide 11 text

What’s Puli? Application translator FOSUserBundle messages.fr.xlst To autoload specialized files /FOS /UserBundle /Command /ActivateUserCommand.php <= /Controller /DependencyInjection /FOSUserBundleExtension.php <= /Resources /translations /messages.en.xlst <= /messages.fr.xlst <= /... 11

Slide 12

Slide 12 text

What’s Puli? To publish assets /web/bundles/fos-user-bundle /css /style.css /images /image.png /vendor/.../FOS/UserBundle /Resources /public /css /style.css /images /image.png 12

Slide 13

Slide 13 text

Puli replaces framework extensions by solving these 3 problems What’s Puli? 13

Slide 14

Slide 14 text

Three targets : Libraries developers Frameworks developers Applications developers What’s Puli? 14

Slide 15

Slide 15 text

Library developers A single config file and your library is available for everyone What’s Puli? 15

Slide 16

Slide 16 text

Frameworks developers Stop wasting efforts by reinventing the wheel What’s Puli? 16

Slide 17

Slide 17 text

Application developers Puli is usable in your application! What’s Puli? 17

Slide 18

Slide 18 text

II. How to use Puli in your application? 18

Slide 19

Slide 19 text

How to use Puli in your application? 19 Puli CLI vs puli.json

Slide 20

Slide 20 text

How to use Puli in your application? 20 puli.json /app /src /vendor /web /composer.json /puli.json

Slide 21

Slide 21 text

How to use Puli in your application? 21 Simplify access to resources

Slide 22

Slide 22 text

How to use Puli in your application? 22 // puli.json { "resources": { "/app": "app/Resources", "/custom-library": "vendor/..." } } Simplify access to resources

Slide 23

Slide 23 text

How to use Puli in your application? 23 require ‘vendor/autoload.php’; $puliClass = PULI_FACTORY_CLASS; $puli = new $puliClass(); $repo = $puli->createRepository(); Simplify access to resources

Slide 24

Slide 24 text

How to use Puli in your application? 24 echo $repo->get('/app/views/index.html.twig') ->getBody(); echo $repo->get('/app/views/index.html.twig') ->getFilesystemPath(); echo $repo->get('/custom-library'. .'/views/index.html.twig') ->getFilesystemPath(); Simplify access to resources

Slide 25

Slide 25 text

meh. How to use Puli in your application? 25

Slide 26

Slide 26 text

puli/composer-plugin How to use Puli in your application? 26

Slide 27

Slide 27 text

Let library developers create their puli.json How to use Puli in your application? 27

Slide 28

Slide 28 text

How to use Puli in your application? 28 // /vendor/acme/custom-library/puli.json { "resources": { "/views": "views", ... } } Simplify access to resources

Slide 29

Slide 29 text

How to use Puli in your application? 29 $ composer require acme/custom-library Updating dependencies (including require-dev) - Installing acme/custom-library (1.0.0) Downloading: 100% Synchronizing Puli with Composer Installing acme/custom-library Deleting the ".puli" directory Running "puli build" Simplify access to resources

Slide 30

Slide 30 text

How to use Puli in your application? 30 echo $repo->get('/acme/custom-library'. .'/views/index.html.twig') ->getFilesystemPath(); Simplify access to resources

Slide 31

Slide 31 text

How to use Puli in your application? 31 Autoload specialized files

Slide 32

Slide 32 text

How to use Puli in your application? 32 // your app puli.json { "resources": { "/app": "app", "/res": "app/Resources" }, "provide": { "/app/config/services.yml": "symfony/services", "/res/translations/*.yml": "symfony/translations" } } Autoload specialized files Defined by Symfony to load your files using Puli $discovery->findBindings('...')

Slide 33

Slide 33 text

How to use Puli in your application? 33 // /vendor/acme/custom-library/puli.json { "resources": { "/config": "res/config", "/translations": "res/translations" }, "provide": { "/config/symfony-services.yml": "symfony/services", "/config/pimple-services.yml": "pimple/services", "/config/php-di-services.yml": "php-di/services", "/translations/*.xlst": "php-fig/xlst-translations" } } Autoload specialized files Usable by libraries! Binding are not necessarily used by the “consumer”

Slide 34

Slide 34 text

How to use Puli in your application? 34 $ composer require acme/custom-library => Services available in your container => Translations available in your translator => Doctrine entities, Twig extensions, ... Autoload specialized files Plug’n’Play (even more than bundles!)

Slide 35

Slide 35 text

How to use Puli in your application? 35 Publish assets

Slide 36

Slide 36 text

How to use Puli in your application? 36 Coming in 2016: puli.js JS library to resolve Puli path in filesystem paths Publish assets

Slide 37

Slide 37 text

How to use Puli in your application? 37 // gulpfile.babel.js gulp.task('babel', () => gulp.src(puli.paths('/app/**/*.jsx') .pipe(babel()) .pipe(ulgify()) .pipe(header('(c) SensioLabs')) .pipe(gulp.dest('web/built/min.js')) ); Publish assets

Slide 38

Slide 38 text

Let’s resume Why Puli is the future of PHP packages 38

Slide 39

Slide 39 text

Puli is for libraries developers 39 Let’s resume

Slide 40

Slide 40 text

40 Less community fragmentation Let’s resume

Slide 41

Slide 41 text

One library to rule them all Develop for every framework at the same time: single codebase 41 Let’s resume

Slide 42

Slide 42 text

Puli is for framework developers 42 Let’s resume

Slide 43

Slide 43 text

Don’t reinvent the wheel, use Puli puli/repository puli/manager puli/discovery 43 Let’s resume

Slide 44

Slide 44 text

Puli is for applications developers 44 Let’s resume

Slide 45

Slide 45 text

Remove framework extensions complexity Install Twig Bundle/Extension/Module Install Twig 45 Let’s resume

Slide 46

Slide 46 text

Plug’n’Play packages composer require => ready to use 46 Let’s resume

Slide 47

Slide 47 text

Less Magic Everything is configured 47 Let’s resume

Slide 48

Slide 48 text

Easy to extend Add your own bindings, your own resources, ... 48 Let’s resume

Slide 49

Slide 49 text

Powerful features Overriding, Versioning, Symbolic links, ... 49 Let’s resume

Slide 50

Slide 50 text

Integrate in your development process Composer, puli.js 50 Let’s resume

Slide 51

Slide 51 text

III. Status of Puli and what’s coming in 2016 51

Slide 52

Slide 52 text

1.0.0-beta10 52 Status of Puli and what’s coming in 2016

Slide 53

Slide 53 text

Already used in production 53 Status of Puli and what’s coming in 2016

Slide 54

Slide 54 text

Documentation on docs.puli.io 54 Status of Puli and what’s coming in 2016

Slide 55

Slide 55 text

Working Symfony bundle puli/symfony-bundle 55 Status of Puli and what’s coming in 2016

Slide 56

Slide 56 text

Projects working on a Puli integration out of the box 56 Status of Puli and what’s coming in 2016

Slide 57

Slide 57 text

Get involved! github.com/puli/issues 57 Status of Puli and what’s coming in 2016

Slide 58

Slide 58 text

Questions? 58 Titouan Galopin SensioLabs University