
5 most needed additions to Laravel 4

When it comes to development, we all try to find more efficient and faster programming methods, sometimes not noticing that someone has already encountered a similar task and gracefully implemented it. What can you say if we reduce our govnokod by 3/4 , just adding a few simple and effective dependencies?
For those who do not know what Laravel 4 is, this is a PHP framework for rapid development. This github open source framework, made for real web programming artisans by the same artisans. As the saying goes, "for programmers from programmers." But the article is not about the charms of Laravel, and not about its advantages over other frameworks, I will gladly tell about this in other articles. Here I will talk about the five most significant and important additions to Laravel 4, which will save you precious minutes of coding.
1. "cartalyst / sentinel": "1.0. *" - On the way to security.
This is an incredibly simple, easy-to-use, and at the same time large-scale authentication system in terms of its capabilities. Laravel 4 has an integrated system, but its capabilities are scarce. Sentinel "out of the box" can manage user groups, roles, password reset and reminders, registration and authorization, native (native) facade to Laravel 4.
Unlike Sentry (previous development of Cartalyst), it’s possible to transfer not only the login attributes login, but also any other fields, work with several permission systems at once, etc. Moreover, the module is fully customizable, and easy to complement, which makes it even more flexible. To be honest, I don’t understand why this package is not included in the Laravel 4 core set!
2. "way / generators": "~ 2.0" - Save time wisely by designing database schemas.
Jeffery Ways, to be honest, is an icon of php encoders. He created a huge number of open-source projects, and a bunch of free video courses on using Laravel 4 and 5. I do not know who Jeffery was before I started using Laravel, but now I keep track of all his work, thoughts and ideas. Ways generators is a whole library of artisan commands, such as, for example, generate: migration which creates a migration file with an already customized scheme, generate: resource which creates a controller, model, and even views, according to REST standards! Now the rapid design of REST controllers has become a reality.
3. "codesleeve / asset-pipeline": "dev-master" - Saves a bunch of nerve cells when working with sass
Codesleeve's Asset Pipeline brings all the power of RoR (Ruby on Rails) to the world of PHP. SaSS and ScSS are very popular among developers, and have already become a mandatory standard for the frontend. However, both scss and sass need to be compiled. Asset Pipeline not only compiles your code, but also minifies it. This module also works with javascript, and will allow you to get rid of intrusive imports of numerous js files of your project.
4. "way / database": "dev-master" - Trump in the sleeve
As already mentioned, Jeffery Way is a real man! He dragged the validation from the controller to the model, and now you can simply apply the save () method in the model. And this module will check if there are any errors () errors at the same time. And the code in the controller becomes clean.
public function store()
{
$dog = new Dog(Input::all());
if ($dog->save())
{
return Redirect::route('dogs.index');
}
return Redirect::back()->withInput()->withErrors($dog->getErrors());
}
A continuation of the idea of MVC, because if you look closely, Laravel violates some conventions of the paradigm, and with this module life becomes better, and the framework takes on even greater power compared to many others.
5. "codesleeve / laravel-stapler" - An indispensable tool for downloading files
I am convinced that everyone was faced with a situation where customers asked to preview these files when downloading files. Well, of course they did. And elegant solutions are not always used. But what if we get out of the head the need for image manipulation, tracking file locations, deleting files from disk, when a record is deleted from the database? This module will allow you to maintain focus on development, since he can do all of the above really great! All that is needed is to run the artisan command, add image parameters, then simply -> save (), and that’s it. The rest will be done by this module.
I hope that this article has opened its eyes to the method of lazy programming, as I call the method of "not repeating the invention of bicycles", and the use of those technologies that allow quickly developing prototypes, or even production, without being distracted by routine and monotonous long actions. Thank you for staying with us!
Free translation of the article revoltvisual.com/journal/5-must-have-laravel-4-packages .
In the original, the author's first item was a review of Sentry (https://cartalyst.com/manual/sentry/2.1#laravel-4), but at the moment, Sentinel is still a more relevant development.