Slide 1

Slide 1 text

The story behind our
 open source efforts

Slide 2

Slide 2 text

About me Freek Van der Herten Partner & developer at SPATIE @freekmurze https://murze.be

Slide 3

Slide 3 text

About me phpantwerp.be Dries Vints @driesvints Frederick Vanbrabant @TheEdonian

Slide 4

Slide 4 text

Since 2003 Websites, applications and webshops Team 4 developers, 1 manager Specialization Laravel development

Slide 5

Slide 5 text

OPEN SOURCE SOFTWARE

Slide 6

Slide 6 text

Open source software We use a lot of it Nginx, Laravel, Ubuntu, Elasticsearch, Memcached, Redis, Beanstalkd, MySQL, Composer, Glide, Homestead, Flysystem, Fractal, Carbon, PHPUnit, NPM, React, jQuery, Java, SSH, Sequel Pro, BackupPC … Basically everything listed in composer.json and package.json

Slide 7

Slide 7 text

± 80 packages on Packagist + 1 000 000 downloads A lot of Laravel specific packages, some framework agnostic ones, a few JavaScript packages We create a lot of it Open source software

Slide 8

Slide 8 text

Zend Framework 1 PHP world was pretty stale around 2012 Laravel 4: developer happiness, clear syntax Laracasts: miniseries on package development + Travis The first package

Slide 9

Slide 9 text

Browsershot: take screenshots of website programmatorically PhantomJS Working in the open People started blogging about it The first package

Slide 10

Slide 10 text

Blender: conversion from Zend Framework to Laravel A lot of functionalities that could be helpful to other developers New packages: laravel-newsletter, laravel-medialib, laravel-analytics Opensourcing Blender itself Very positive feedback from the community Beyond the first package

Slide 11

Slide 11 text

Every package gets born inside a client project Almost every client project results in a package laravel-sitemap, opening-hours, … Beyond the first package

Slide 12

Slide 12 text

Making time Time consuming Coding, writing tests, writing docs, getting the word out Maintenance, responding to issues, reviewing PRs 1000 issues, 750 PRs

Slide 13

Slide 13 text

Making time Only plan 4 days a week for client work Extra day for support, learning and opensource efforts Free time

Slide 14

Slide 14 text

The benefits of creating packages A lot of learning by coding up the package and writing tests Feedback from the community Free code! Dogfooding

Slide 15

Slide 15 text

Requirements Latest version of PHP / Laravel Package reflects the requirements of the project it gets born in Can use latest features: return type hints, null coalescing, anonymous classes PHP 5 is dead (to us) Probably hurts popularity, but nudges community to use latest versions

Slide 16

Slide 16 text

TOP 10

Slide 17

Slide 17 text

10. laravel-permission $role = Role::create(['name' => 'writer']);
 $role->givePermissionTo('edit articles');
 $user->assignRole('writer');
 $user->can('edit articles’);

Slide 18

Slide 18 text

9. laravel-fractal fractal()
 ->collection($books)
 ->transformWith(new BookTransformer())
 ->includeCharacters()
 ->toArray();

Slide 19

Slide 19 text

8. laravel-tail php artisan tail

Slide 20

Slide 20 text

7. laravel-medialibrary $newsItem->addMedia($file) ->toCollection('images'); 
 $newsItem->getMedia('images')->first()->getUrl(); 
 $newsItem->getMedia('images')->first()->getUrl('thumb');
 
 $newsItem->addMedia($bigFile) ->toCollectionOnDisk('downloads', 's3');

Slide 21

Slide 21 text

6. db-dumper Spatie\DbDumper\Databases\MySql::create()
 ->setDbName($databaseName)
 ->setUserName($userName)
 ->setPassword($password)
 ->excludeTables(['table1', 'table2', 'table3'])
 ->dumpToFile('dump.sql');

Slide 22

Slide 22 text

5. laravel-analytics Analytics::fetchMostVisitedPages(); Analytics::fetchVisitorsAndPageViews(); 
 Analytics::getTopReferrers();

Slide 23

Slide 23 text

4. string string('StartMiddleEnd')
 ->between('Start', 'End')
 ->toUpper(); // outputs "MIDDLE"

Slide 24

Slide 24 text

3. laravel-glide GlideImage::create($pathToImage)
 ->modify(['w'=> 50, 'filt'=>'greyscale'])
 ->save($pathToWhereToSaveTheManipulatedImage);

Slide 25

Slide 25 text

2. pdf-to-image $pdf = new Spatie\PdfToImage\Pdf('file.pdf');
 $pdf->saveImage($pathToImage);
 
 collect(range(1, $pdf->getNumberOfPages()), function(int $pageNumber) use ($pdf) {
 $pdf->setPage($pageNumber)
 ->saveImage("page{$pageNumber}.jpg");
 });

Slide 26

Slide 26 text

1. laravel-backup

Slide 27

Slide 27 text

HIGHLIGHTS OUTSIDE TOP 10

Slide 28

Slide 28 text

Laravel Menu Menu::macro('main', function () {
 return Menu::new()
 ->action('HomeController@index', 'Home')
 ->action('AboutController@index', 'About')
 ->action('ContactController@index', 'Contact')
 ->setActiveFromRequest();
 });

Slide 29

Slide 29 text

Speed up your application 
 by caching the entire response Laravel Responsecache RESPONSE CACHE REQUESTS APP 1 2

Slide 30

Slide 30 text

Laravel Translatable $newsItem = new NewsItem; // This is an Eloquent model
 $newsItem
 ->setTranslation('name', 'en', 'Name in English')
 ->setTranslation('name', 'nl', 'Naam in het Nederlands')
 ->save();
 
 $newsItem->name; // Returns 'Name in English'
 $newsItem->getTranslation('name', 'nl');

Slide 31

Slide 31 text

https://spatie.be/opensource

Slide 32

Slide 32 text

Not free!

Slide 33

Slide 33 text

POSTCARDWARE

Slide 34

Slide 34 text

Spatie
 Samberstraat 69D 2060 Antwerp
 Belgium

Slide 35

Slide 35 text

Future plans No roadmap Depends on the client projects Will probably diminish a bit as the most common problems are solved

Slide 36

Slide 36 text

In closing Working on packages has a lot of benefits It’s fun Social aspect Can be recommended to everyone

Slide 37

Slide 37 text

QUESTIONS?

Slide 38

Slide 38 text

Thank you! https://speakerdeck.com/freekmurze/open-source-efforts https://murze.be https://spatie.be/opensource