How to compress file in tar.gz from external url with Laravel using PHP Phar

Php Phar is powerful file compression tool, first of all change config in your php.ini  and trun off read-only “phar.readonly=off” in your php.ini  // external file url, filename and local path $url = “http://youtr external file url;” $filename = basename($file->url).”.tar”; $localfile = storage_path(“app” . DIRECTORY_SEPARATOR . $filename); //make tar.gz file from add file method $targz […]

Read More

How to create a custom error page in Laravel.

In laravel there is default view for error page but when you need to make json format error response there is some thing you need to change in your handler file, for json response in error you can change your app\Exceptions\Handler.php file with following method. 1. include symphony’s NotFoundHttpException in you class. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;   […]

Read More

Aside

How to make dynamic route in Laravel

you can work in Laravel without defie any route, there is way to make dynamic route request form your app.

add this line in your route file.

Route::any('/{method}', '\App\Services\CustomService@method');

create “CustomService”  class file in your “App\Services” folder , which handle all route from client request, then you can directly call your function name without defining route, even though you have to define your methods in CustomService class.

Read More

Image

How to make a huge microservice architecture system using Laravel and Lumen ?

From last three months i’m working in a project, which have six different component as six different server, each component have it’s own database,  and each server communicate with  each other using HTTP connection. it’s pretty exciting, when Laravel as main API component and Lumen as microservice component,  which authenticate with JWT and provide data in Json format.

Read More