Posts From Category: PHP

Email templates optimization for Laravel

Optimize your email templates’ styles via native Laravel templating mechanism.

If you want to send an HTML email you can’t just send it with <style></style> tag in it, or link a stylesheet. Most of the email clients will cut it and clients will see your email without any styles.

The only approach to achieve best email quality is to convert all your styles int inline style="" attributes.

Read More

API Exceptions for Laravel

All in one solution for exception for JSON REST APIs on Laravel and Lumen.


The goal of this package is to provide you with a set of most common exceptions that may be needed while developing JSON REST API. It also:

  • Handles exceptions output.
  • Handles exceptions report to logs.
  • Overwrites default Validator to make validation errors more verbose.
  • Has a FormRequest that to handle validation errors and pass them to ApiExceptions layer.
  • Has middleware to catch all system errors such us RuntimeExceptions or ModelNotFoundException to handle them and threat as normal ApiExceptions.

Read More

Add handy setup wizard to your Laravel project

Imagine that you distribute your Laravel project. It is awesome, useful and remarkable. But every time your customer installs it, he has to perform a set of steps to setup it: add .env file, run migrations and seed, etc. And you have to mention them all in your README and hope that user will do everything right. But why not to guide your customer through all this steps with one simple command?

All you have to do is to add Laravel-Setup-Wizard package to your project!


Read More

Laravel + Hashids

Everyone nowadays used youtube or any short link creator. If you look to the links they use (eg. you will notice that they use unique string hashes instead of common auto-increment ids. They do it because anyone can just iterate ids and get access to all their content. And of course they don’t want it.

If you want to protect your content too, you have to replace your ids with hashes. There are lots of tools that can convert integers to unique hash ids. They work practically identically, and I will show how to integrate one of them Hashids with Laravel.

There are lots of packages that already integrate Hashids into Laravel, but they only add it’s facade and give some syntactic sugar. But we need complex integration with easy model binding and all logic under the hood! So let’s do the magic!

Read More

Extend your Laravel Seeder

Laravel brings you awesome seeding functionality. But it is not as perfect as it could be. By default Laravel Seeder was made to store random data (it even suggests you to use Faker package). But what will you do if you have lots of data that already exists in my DB? There are several ways to achieve this. You can import raw arrays, SQL data, or use CSV files. I choose the third approach because CSV files are easier to edit. That’s why I created a Laravel-Extend-Seeder package that implements this method.

Read More

  • PHP

An easy way to create forms of any complexity with validation and filtration.

1000 Forms


  • It can be used in any sort of projects to build any sort of forms.
  • Any functionality can be extended. Validators, filters, elements - everything can be modified.
  • Markups of all elements and whole form can be modified as you like. Even by using a template
  • It already has a built-in engine to validate all the inputs
  • You can modify and filter all the values right in the form
  • You can create dynamic forms with array values

Simple example

// Initialise object
$form = new \Lanin\Forms\Form();

// Set name of our form

// Add "Name" textfield
$form->addElement('textfield', 'login', array('label' => 'Name'));
// Add "Password" element
$form->addElement('password', 'password', array('label' => 'Password'));

// And add submit button
$form->addElement('submit', 'login', array('value' => 'Login'));

// Check if form was submitted and values are valid
if ($form->isValid()) {
    // Get values and print them

// Print our form
print $form;

Released under MIT license.

Read More