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
160
I shall define this only once
freekmurze
0
350
An Introduction to Snapshot testing
freekmurze
0
430
Event Sourcing In Laravel
freekmurze
0
210
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
740
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
780
A practical look at multitenancy in Laravel
freekmurze
1
310
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
670
Highlights Flare codebase (Laracon online)
freekmurze
0
430
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
How STYLIGHT went responsive
nonsquared
95
5.2k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Automating Front-end Workflow
addyosmani
1366
200k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Facilitating Awesome Meetings
lara
50
6.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Rails Girls Zürich Keynote
gr2m
94
13k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
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