Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Some Handy Laravel Packages
Search
Freek Van der Herten
November 17, 2016
1
260
Some Handy Laravel Packages
Given at the Laravel meetup at #phpantwerp
Freek Van der Herten
November 17, 2016
Tweet
Share
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (Laravel Live Denmark)
freekmurze
0
200
I shall define this only once
freekmurze
0
410
An Introduction to Snapshot testing
freekmurze
0
490
Event Sourcing In Laravel
freekmurze
0
250
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
800
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
850
A practical look at multitenancy in Laravel
freekmurze
1
350
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
730
Highlights Flare codebase (Laracon online)
freekmurze
0
510
Featured
See All Featured
Writing Fast Ruby
sferik
628
62k
Optimizing for Happiness
mojombo
379
70k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
It's Worth the Effort
3n
185
28k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Faster Mobile Websites
deanohume
307
31k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
A Tale of Four Properties
chriscoyier
160
23k
Gamification - CAS2011
davidbonilla
81
5.4k
Transcript
Some handy Laravel packages
About me Freek Van der Herten Partner & developer at
SPATIE @freekmurze https://murze.be
Since 2003 Websites, applications and webshops Team 4 developers, 1
manager Specialization Laravel development
OPEN SOURCE SOFTWARE
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
± 90 packages on Packagist Laravel, Framework agnostic PHP +
1 200 000 downloads in total, growing 200 000 a month We create a lot of it Open source software
http://github-awards.com/users?type=world&language=php Open source software
https://spatie.be/opensource
TOP 10
10. laravel-permission $role = Role::create(['name' => 'writer']); $role->givePermissionTo('edit articles'); $user->assignRole('writer');
$user->can('edit articles’);
9. laravel-fractal fractal() ->collection($books) ->transformWith(new BookTransformer()) ->includeCharacters() ->toArray();
8. laravel-tail php artisan tail
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');
6. db-dumper Spatie\DbDumper\Databases\MySql::create() ->setDbName($databaseName) ->setUserName($userName) ->setPassword($password) ->excludeTables(['table1', 'table2', 'table3']) ->dumpToFile('dump.sql');
5. laravel-analytics Analytics::fetchMostVisitedPages(); Analytics::fetchVisitorsAndPageViews(); Analytics::getTopReferrers();
4. string string('StartMiddleEnd') ->between('Start', 'End') ->toUpper(); // outputs "MIDDLE"
3. laravel-glide GlideImage::create($pathToImage) ->modify(['w'=> 50, 'filt'=>'greyscale']) ->save($pathToWhereToSaveTheManipulatedImage);
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"); });
1. laravel-backup
BONUS: HIGHLIGHTS OUTSIDE TOP 10
Laravel Menu Menu::macro('main', function () { return Menu::new() ->action('HomeController@index', 'Home')
->action('AboutController@index', 'About') ->action('ContactController@index', 'Contact') ->setActiveFromRequest(); });
Speed up your application by caching the entire response
Laravel Responsecache RESPONSE CACHE REQUESTS APP 1 2
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');
Laravel Tags $newsItem = NewsItem::create([ 'name' => 'testModel', 'tags' =>
['tag', 'tag2'], ]); $newsItem->attachTags(['tag4', 'tag5']); $newsItem->detachTags(['tag4', 'tag5']); $newsItem->syncTags(['tag1', 'tag2']); NewsItem::withAnyTags(['tag1', 'tag2']); NewsItem::withAllTags(['tag1', ‘tag2']);
Laravel Uptime Monitor
Laravel Uptime Monitor
https://spatie.be/opensource
Not free!
POSTCARDWARE
Spatie Samberstraat 69D 2060 Antwerp Belgium
QUESTIONS?
Thank you! https://speakerdeck.com/freekmurze/some-handy-laravel-packages https://murze.be https://spatie.be/opensource