Category: PHP

Two tips to speed up bitbucket pipelines

In the past few days, I was playing around with pipelines to see what can I do with it, and how much can I squeeze it to get as much as I can from the functionality they offer. And I wanted to point out to two main things that you can do to speed up your PHP testing a bit, not much but a bit which counts.

First of all, if you don’t use the built-in composer cache functionality, then you need to do that right away, and enabling it is just a small line of code that you add to the test section like

Nothing else, once you have done that you will use the cache they offer and no need to redownload the packages from the internet and the cache will be invalidated automatically after 7 days (if am not mistaken), but this does not mean you don’t have the ability to delete the cache manually. But keep in your mind that each section should use the caches tag otherwise it won’t be useful, sadly Bitbucket pipeline does not offer a global cache feature.

Secondly, remember to install and use hirak/prestissimo package globally, which will give you a nice speed as we all know.

so your file can have something like:


Filed under: Code, docker, PHP

New Chatbot project for fun

In the past few days, I decided to try something new so I started to play with bots and created this nice little guy here.

The idea of the project is simple, you ask him about the price of any crypto currency and he will reply back, you can even specify the equivalent currency that you want.

Here is a small video about it.

Let me know what do you think.

Am not going to release it for public yet, first I need to build a good infrastructure for it

Filed under: Code, Laravel, Linux, Other, Personal, PHP, Video

Running Laravel Dusk tests on Bitbucket, the easy way

So today I was trying to run and see if I can manage to get Laravel dusk to run on Bitbucket pipelines, and after too many tests, I was able to do so \(^ ^)/.

In this post I’ll explain the minimum requirements you need to do that, to make things simple, I created a docker image based on PHP 7.2 that you can use directly.

Configure your Laravel project:

After installing Laravel and Laravel dusk (you can read all about it on the docs), you can create a new environment file called .env.dusk which contain the following:

Continue reading

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

[Tip] Connect to multiple databases on the Fly with Lumen

Its not always an easy way to connect to different database if the configuration files does not include any information about it, in older version it was even a tricky one, especially if you have a bit of relationship that you want to use.

Don’t understand from my words that you cant do that, but it was not a direct use of setConnection , from my memory, the setConnection function used to force the connection on the current model only not the children nor any other one that it has a relationship with, when the info for this connection was not part of the database config file.

Things has changed and now in Lumen 5.5 (I didn’t try it with older version), as now you can use the function on to enforce the connection on the Model and any relationship it needs. like the following:

Create a base Model and create a function within called mergeConnections:

Continue reading

Filed under: Code, Laravel, PHP

Manually run your Bitbucket Pipelines

In the earlier post, we have talked about how to test your Laravel  application with Bitbucket Pipelines, but sometimes you may need to run the tests on specific commit and not after you push it, luckily for us Bitbucket Pipelines team has implemented the custom section in the ymal file, which helps us to do so.

It does not differ that much from what we already have, so adding the following to our file which we created in the earlier  post will enable us to manually run the pipeline:

Continue reading

Filed under: Code, docker, PHP