API documentation becomes very necessary when you split the team into Backend and Frontend. And even more when you divide your monorepo into parts or even microservices.

I will show you how easily create API documentation for your Laravel API using swagger.

Let’s start. I prefer using this package. This package is a wrapper of Swagger-php and swagger-ui adapted to work with Laravel.

composer require "darkaonline/l5-swagger"

Then publish config and all view files:

php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"

Next, open a config/l5-swagger.php file. Let’s walk through essential keys:

Laravel vapor

App autoscaling is not a trivial task as it might look. I was really excited when I read about Vapor. I would like to share my experience of playing with this great tool.

Project size

Our project is nearly 650Mb and Lambda has limitations of 250Mb unzipped.

We had a few binaries in our composer dependencies. I tried to remove them but it doesn’t help.

Want to read this story later? Save it in Journal.

Also removed all dev dependencies. Make sure that you don’t use any PHPUnit functions in your code. For example: assert() etc.

Next, I found out…

There are a lot of amazing ready to use laravel packages on Github and packages. Every project uses open-source packages. The only problem with open source is the lack of maintenance as it is not a full time paid job for contributors.

Laravel is a very rapidly developed PHP framework with a new major release every six months. It is an additional overhead for package maintainers. You may end up with a situation when the package is not updated to be compatible with the latest framework version. In this case, you have to create your fork. …

This article is an updated version of Larave 5.5 package development article

Step 1. Create a new project

I prefer using the Laravel installer. You can read more about the installation here: https://laravel.com/docs/7.x/installation

laravel new lara-dg

I prefer using SQLite for testing and package development. Adjust your.env file


Then let’s create our package skeleton. We will be using a CLI tool. It will generate all necessary files

composer require jeroen-g/laravel-packager

Then you can run generation command. Webkid stands for vendor name(your namespace) and LaravelDiagnostic as the name of your project

php artisan packager:new Webkid LaravelDiagnostic --i

Then type information about your package and you…

Testing is good. I’m a big fan of well tested code but nobody likes waiting tests to be finished. It is ok when you have a few hundreds of them or less. But when we reached a 2K number it became a really frustrating issue.

In our case all integration and unit test lasted nearly for 1 hour:

2000 tests => 60 minutes

So we tried to optimize test execution efficiency.

First we reviewed our model factories and fixed one small issue:

array_get($overrides, 'user_id', factory(User::class)->create()->id)
array_get($overrides, 'user_id') ?? factory(User::class)->create()->id

The problem is that 3rd parameter in array_get function…

Let me introduce our new laravel package for logging console commands.

It was developed specially for our Tenantcloud project. It is rather simple but at the same time really useful.

In our development process we faced with the problem of many cron jobs and console commands. Some of them were executing for a long time and we could not debug it. So we created simple package for this purpose.

To install it simply type:

composer require tenantcloud/command-logger

And add CommandLoggerServiceProvider to your config/app.php file.

By default it saves log information into Database and Log files. …

First of all I want to thank Cristian Tăbăcitu for his cool article about package development.My article is just an extension of his article. Here I will cover all steps of creating, maintaining and using packages. I will be using my laravel-boolean-softdeletes package as an example.

Step 1. Create new project

I prefer using Laravel installer. You can read more about installation here: https://laravel.com/docs/5.5/installation#installing-laravel

laravel new laravel-boolean-softdeletes

Generate unique APP_KEY

php artisan key:generate

I prefer using sqlite for testing and package development. Adjust your.env file


Then lets create our package skeleton. We will be using CLI tool. It will generate all necessary files

There is no predefined interface for changing queue for event listeners in Laravel 5.3. By default, it is always taken from your config.

My solution:

Create an abstract class for your listeners:

namespace App\Listeners;/** * Class BaseListener */ abstract class BaseListener { /** * Detects if class has queue or delay parameter * If has queue parameter than pushes to certain queue * * @param $queue * @param $job * @param $data * @return mixed */ public final function queue($queue, $job, $data) { if (isset($this->queue, $this->delay)) { return $queue->laterOn($this->queue, $this->delay, $job, $data); } if (isset($this->queue)) { return $queue->pushOn($this->queue, $job, $data); }…

Ivan Kolodiy

CTO at TenantCloud

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store