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
180
I shall define this only once
freekmurze
0
380
An Introduction to Snapshot testing
freekmurze
0
460
Event Sourcing In Laravel
freekmurze
0
230
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
770
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
820
A practical look at multitenancy in Laravel
freekmurze
1
330
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
700
Highlights Flare codebase (Laracon online)
freekmurze
0
460
Featured
See All Featured
Designing for Performance
lara
605
68k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Designing Experiences People Love
moore
140
23k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Automating Front-end Workflow
addyosmani
1369
200k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
580
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
Testing 201, or: Great Expectations
jmmastey
42
7.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
Music & Morning Musume
bryan
46
6.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