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
400
An Introduction to Snapshot testing
freekmurze
0
490
Event Sourcing In Laravel
freekmurze
0
240
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
720
Highlights Flare codebase (Laracon online)
freekmurze
0
500
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Embracing the Ebb and Flow
colly
86
4.7k
The Pragmatic Product Professional
lauravandoore
35
6.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
123
52k
We Have a Design System, Now What?
morganepeng
52
7.6k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Adopting Sorbet at Scale
ufuk
77
9.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
900
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
Building Adaptive Systems
keathley
43
2.6k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
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