Category: Laravel

How to test your Laravel application with Bitbucket Pipelines

Bitbucket Pipelines is a CI service that you can use to test your application, yes it has its own limitation, but remember it is still new and hopefully it will get better. Today I had the chance to work with it, and trust me I was not planning to do so, am a happy Gitlab-ci user, but why not.

Each of these service has its pros and cons, and am not planning to go over it and list it, just do a small reading to find the differences, so today I’ll talk about how to test your Laravel Application with Bitbucket Pipelines and how you can get it fast.

Requirements:

For sure you need to know Laravel and how to write tests, this post will not talk about it, and it would be nice if you know a little bit of Docker.

Enabling Pipelines:

You will need to enable the pipelines from the Repository Settings as the following image

Continue reading

Filed under: Code, docker, Laravel, PHP

How to test and auto deploy your laravel code from Gitlab

Few days ago, I was playing with the new Laravel 5.4 and Gitlab CI, and got to the point where I wanted the CI to test my code once I push it.

Using google lead me to this post on Laracasts, and it was the starting point for me, there you can get important files .gitlab-ci.yml and .gitlab-ci.sh  , basically the first one will define the stages for the testing and the second one will build the environment for your test.

So lets look at a short version of .gitlab-ci.yml

Continue reading

Filed under: Business, Code, docker, Laravel, Linux, MySQL, PHP

Books I need to finish this month or so

This is just a small list of all the books which I was reading and planing to finish them ASAP, they are hanging and I cant figure out a correct time to finish them so hopefully listing them here will help me do it.

  1. Laravel Code Smart ( https://leanpub.com/codesmart/ )
  2. Easy E-Commerce Using Laravel and Stripe ( https://leanpub.com/easyecommerce )
  3. Domain-Driven Design in PHP ( https://leanpub.com/ddd-in-php )
  4. Servers for Hackers ( https://leanpub.com/serversforhackers )

I have started reading only the first and the second book ( sadly ), but am planing to finish and go to finish the list by the end of the next month or so ..

 

Filed under: Books, Code, Laravel, Linux, Nginx, PHP

Fix “HTTP Error 413 Request entity too large” problem

Yesterday Jeff Madsen has sent a small Laravel tip which address how you can validate the post size for your uploaded data via Laravel middleware called VerifyPostSize.

Even though the solution is valid when you have no control over your server, but when you do, you should fix the base of the problem which is your web server (in my case its Nginx ).

Normal when you upload a file, the process looks like this :

webservers

1- The user request the website

2- The Server get the request first and forward it to PHP process.

3- PHP process do the magic and response back to the Server.

and the data get back from 3 to 1 .

Now as I said the solution which was provided solve the problem at the PHP processes level not at the Web server, at the end the data need to go through the server first.

In nginx documentation we have a core module which control the size of the data which the client can send through the server, the default size is 1Mb, so to fix this problem you need to do the following:

1- edit the file /etc/nginx/nginx.conf and make sure that  the value for client_max_body_size is big enough like:

2- edit your php.ini file to make sure that you have setup the upload size and memory with big values like :

lastly you need to restart nginx.

now just a small note, you will need to adjust the values based on your needs, there are no magic values which can solve your issue here.

If you find that this information is incorrect, please let me know via email z[At]zah.me or via contact page I’ll be happy to get more information about this topics from experienced people out there.

PS: as usual, since english is not my mother language, you might find some errors, so if you do let me know and I will be happy to fix it.

Filed under: Code, Laravel, Linux, Nginx, PHP

How I setup Vagrant + Homestead on Windows 10

Ok, I will try to make it simple and fast, I might not have all the links right now ready but I will try hard to give as much info as I can.

For the past few month I had tried to setup my windows laptop as a development machine, and trust me I always failed to make it work nicely with Vagrant and Homestead or any Vagrant box for PHP development.

The problem was not the boxes, but in other issues, like the fact that windows does not have real Terminal (yes CMD is not a real terminal), and that it wont come with everything you need, so here is how I did it (cause today was a success story for me) .

Last Friday my lovely wife (Hala) helped me to upgrade my HDD to SSD, and yes I don’t like to play with hardware thats why she did it for me :D, and since I have upgraded my windows to version 10 Pro (thanks for the free upgrade Microsoft), I did a fresh install and it worked like a charm .

Continue reading

Filed under: Code, Laravel, PHP