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
270
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 (ode aan de code)
freekmurze
0
26
Uncharted packages (Laravel Live Denmark)
freekmurze
0
220
I shall define this only once
freekmurze
0
420
An Introduction to Snapshot testing
freekmurze
0
510
Event Sourcing In Laravel
freekmurze
0
260
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
830
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
860
A practical look at multitenancy in Laravel
freekmurze
1
360
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
740
Featured
See All Featured
Building Adaptive Systems
keathley
44
2.8k
How STYLIGHT went responsive
nonsquared
100
5.8k
Embracing the Ebb and Flow
colly
88
4.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
44
7.8k
Raft: Consensus for Rubyists
vanstee
140
7.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
115
20k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Thoughts on Productivity
jonyablonski
70
4.9k
The Language of Interfaces
destraynor
162
25k
The Cult of Friendly URLs
andyhume
79
6.6k
Building an army of robots
kneath
306
46k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
22k
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