Useful Laravel Dependencies
Laravel is a powerful PHP framework. Like many other PHP systems, it benefits from the use of Composer to manage its dependencies, making the use of open-source libraries extremely simple.
What follows is a list of the packages (or dependencies) I am using in most of my current projects—let me explain you why.
A package I discovered a few weeks ago. It gives your Laravel app the possibility of adding translations for your SQL tables to various different languages, with a really flexible structure. You can, for instance, have the articles in your blog written in English by default, and only translate to certain languages the ones you want.
Then, you can show those translated languages for users that have selected that locale on their browser, but fallback to the default language if an article is not available in their language.
A package based in Carbon. It makes ridiculously simple working with dates, with support for all languages.
Some of the features I use the most are: parsing database dates to human-readable ones (2015-06-14 could be translated to Sunday 14, June 2015); expressing how long ago a content was created (posted 2 minutes ago, for instance); calculating dates in the past or in the future, by adding or substracting days, weeks, months (or whatever unit) to a date object.
Possibilities are unlimited, and this library makes it even easier that before.
With this package, you can use the Taggable trait to any of your models, and start tagging them. Then, you can use the query builder with its own methods to filter your content depending on tags.
I have been using it for articles and projects, to organize content and allow users to navigate by article categories.
If you are designing with SCSS, you need a parser o automate the generation of your CSS files. This package does the job for me pretty well.
It allows you to run inline PHP functions specifying what SCSS folder to parse, and where to save the CSS. Also, it has an in-built function to minify your CSS files, compressing them a lot, so you don’t have to worry about it.
For development purposes, I tend to set a GET variable on the App::before() filter function (located on app/filters.php) to force generate new CSS files. Running the URL /home/?scss=1, for instance, would regenerate all my CSS files.
Based on Michelf’s PHP parser, this package implements methods to parse Markdown text from strings or files directly.
One example would be calling Markdown::string($string) in your code to parse the $string from markdown to HTML.
If you know other PHP packages that I should know of, please drop me a tweet! Thanks for reading.