📜 ⬆️ ⬇️

5 of the most necessary additions to Laravel 4

image

When it comes to development, we are all trying to find more efficient and fast ways of programming, sometimes not noticing that someone has already encountered a similar task, and elegantly implemented it. What do you say if we reduce our govnod by 3/4, just by 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 open source framework on github is 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 be happy to 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 coding minutes.
')


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. Laravel 4 has a built-in system, but its capabilities are scarce. Sentinel "out of the box" is able to manage user groups, roles, password reset and reminders, registration and authorization, native (native) facade to Laravel 4.

Unlike Sentry (the previous development of Cartalyst), it allows you to transfer not only the login itself, but also any other fields, to work with several permission systems at once, etc., as login attributes. Moreover, the module is fully customized, and easily complemented, which makes it even more flexible. To be honest, I do not understand why this package is not included in the basic set of Laravel 4!

2. "way / generators": "~ 2.0" - Save time wisely by designing database schemas.



Jeffery Ways, to be frank, is an icon for php coders. He created a huge number of open-source projects, and a bunch of free video courses on using Laravel 4 and 5. I don't know who Jeffery was before I started using Laravel, but now I am tracking all of his work, thoughts and ideas. Ways generators are a whole library of artisan commands, such as, for example, generate: migration, which creates a migration file with an already customized schema, generate: resource that 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 the full power of RoR (Ruby on Rails) to the PHP world. SaSS and ScSS are very popular among developers, and have already become an obligatory standard for the frontend. However, both scss and sass need to be compiled. Asset Pipeline not only compiles your code, but also minimizes it. This module also works with javascript, and will get rid of annoying imports of numerous js files of your project.

4. "way / database": "dev-master" - Trump up the sleeve



As already mentioned, Jeffery Way is a real man! He dragged validation from the controller to the model, and now you can simply use 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()); } 

The continuation of the idea of ​​MVC, because if you look closely, Laravel violates some paradigm conventions, and with this module life becomes better, and the framework gains even more power compared to many others.

5. "codesleeve / laravel-stapler" - an indispensable tool when downloading files



I am convinced that everyone was faced with a situation where clients asked them to do a preview of these files when downloading files. Well, of course they did. And not always elegant solutions are used. But what if we knock out the need to manipulate images, track file locations, delete files from disk when a record is deleted from the database? This module will keep the focus on the development, as he can do all the above mentioned things really great! All you need is to run the artisan command, add image parameters, then simply -> save (), and that’s all. The rest will make this module.

I hope that this article opened my eyes to the lazy programming method, so I call the method “non-repetition of the invention of bicycles”, and the use of those technologies that will allow you to quickly develop prototypes, or even production, without being distracted by the routine and repetitive actions. Thank you for your attention, stay 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 this point in time, the most relevant development is still Sentinel.

Source: https://habr.com/ru/post/244597/


All Articles