Dependecy injection in Laravel
A great talk by John Arstingstall about dependency injection, aka the ioC Container.
http://vimeo.com/88888213
A great talk by John Arstingstall about dependency injection, aka the ioC Container.
http://vimeo.com/88888213
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"If you are one of the *millions* who have downloaded a Spatie package, then you understand the quality that Freek aims for. The newsletter is of the same quality of any Spatie package you're using."
Obfuscating ids in urls is a great way of hiding your application's internals from your visitors. It reduces the chance for malicious users to guess urls and prevents everyone from knowing how many user accounts or articles your website has.Jens Segers introduces the hashids library and proposes a very nice way on how to use it in Laravel 5.
http://jenssegers.be/blog/64/easy-id-obfuscation-with-laravel-5
An old, but still relevant, blogpost by Derick Rethans (of Xdebug fame) about why the @-operator should be avoided.
http://derickrethans.nl/five-reasons-why-the-shutop-operator-should-be-avoided.html
https://github.com/slampenny/SmartSeederSeeding as it is currently done in Laravel is intended only for dev builds, but what if you want to seed a production database with different data from what you use in development? What if you want to seed a table you've added to a database that is currently in production with new data?
This package allows you to use Laravel seeders in the same way you're using migrations.
GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly.
http://goaccess.io
Back in September Taylor Otwell said that Laravel 4.3 would be renamed to Laravel 5 to reflect a directory change and “other interesting initiatives”. Since that announcement the excitement for Laravel 5 has been building and “other interesting initiatives” turned into almost two dozen new features to help developers be more productive.Eric Barnes made a nice list of the most notable new goodies in Laravel 5. The shiny new version of the framework will be released next week.
My current hosting provider, DigitalOcean, has a great backup service. It takes frequent snapshots of entire droplets and it's very easy to restore the snapshot quickly. Unfortunately backups are only taken once every week. For our clients this is not acceptable. If you only rely solely on the DO…
When installing an SSL certificate on your server you should install all intermediate certificates as well. If you fail to do so, some browsers will reported "untrusted" warnings for your site like this one: Searching and downloading those intermediate certificates can be a hassle. It…
This tool allows you to list all your DO-droplets, SSH into them, take a snapsnots, resize them, and more from the command line.
One thing frameworks have been providing for many years is HTTP message abstraction. PSR-7 aims to provide a common set of interfaces so that frameworks can use the same set of abstractions. This will enable developers to write re-usable, framework-agnostic web components that frameworks can consume.https://mwop.net/blog/2015-01-26-psr-7-by-example.html
This weekend at the PHPBenelux 2015 conference I went to a session about higher order programming by Mathias Verraes. Higher-order programming is a style of programming that uses functions as values.
During the session Mathias demonstrated his Lamdalicious library. This library brings the principles of LISP to PHP. The talk was very fast paced and everything was live coded. PHP was misused to the fullest: global variables, error suppression, ... and there was lots of recursion going on. Basically he was constructing another language in PHP. During the talk there were lots of ooohhss and aaahhhss in the room, so I suspect I was not the only one enjoying it.
If you are intrigued by this, be sure to read his blog post on the subject. The blog post is essentially the written down version of the talk.
You'll never use any of this code in production, but that's not the goal of the library. Like when doing code katas, the train of thought is much more important than the result.
Here's another wonderful blog post.
Composer is one of the most important pillars of the PHP renaissance. If you're not using it, you're doing it wrong.
It's main repository Packagist reports that there were 525 773 737 package installs since april 2012.
Earlier this month Glide joined The League of Extraordinary Packages. This package provides an easy way to generate image manipulations on the fly. Within a couple of hours I had integrated this wonderful package into both my company's legacy and current CMS.
The current CMS is based on Laravel. The Glide-integration is now available as a package on github: freekmurze/laravel-glide.
<img src="{{ GlideImage::setImagePath('kayaks.jpg')->setConversionParameters(['w'=> 50, 'filt'=>'greyscale']) }}" />
The function will output an URL to a greyscale version of kayaks.jpg that has a width of 50 pixels. As soon as the URL gets hit by your browser, the image will be generated on the fly. The generated image will be saved in app/storage/glide-cache (= the cache directory specified in the input file).
The generated URL will also be signed to prevent jerks from generating unwanted manipulations.
The setConversionParameters-function accepts an array with conversion options. You can take a look at the image API of Glide to see which options are available.
It's also possible to generate an image directly on the server:
GlideImage::setImagePath('kayaks.jpg')
->setConversionParameters(['w'=> 50, 'filt'=>'greyscale'])
->save($fileWhereImageManipulationMustBeSaved);
This is a list of projects which have curated tasks specifically for new contributors. These are a great way to get started with a project, or to help share the load of working on open source projects.http://up-for-grabs.net/
If you want to start contributing to open start software, but don't know where to begin, just use the above site to help fix some low hanging fruit.
Zend Framework 3 will be an evolution from ZF2, concentrating on simplicity, reusability, and performance.http://framework.zend.com/blog/announcing-the-zend-framework-3-roadmap.html
Optimizing for PHP7, and supporting PHP 5.5 seems like a good idea.
This is a spaceship operator: "<=> ". It's still being discussed but there's a big chance you'll get to use it in PHP7.
The operator returns 0 if both operands are equal, 1 if the left is greater, and -1 if the right is greater.
Instead of this
function order_func($a, $b) {
return ($a < $b) ? -1 : (($a > $b) ? 1 : 0);
}
you can do
function order_func($a, $b) {
return $a <=> $b;
}
In this video Steven Salevan, a site reliability engineer (cool title) for Twitter, explains how they use Ansible to manage thousands of their servers.
https://www.youtube.com/watch?v=fwGrKXzocg4
http://www.theguardian.com/info/developer-blog/2015/jan/05/delivering-continuous-delivery-continuouslyIn 2011 the Guardian deployed the software behind the website 25 times. It was a laborious and fairly manual process. In 2014 we made more than 24,000 highly automated production deployments. Why and how did we do it?