GitHub Action Hero: Shivam Mathur and “Setup PHP”

Image of Michelle Mannering

GitHub Actions gives you the power to automate your workflow. Connect with the tools you know and love. Have more freedom to innovate and be creative. Deploy to any cloud, build containers, automate messages, and lots more. It’s time to take control.

There’s lots of amazing Actions built every day. We’ve been chatting to some of the coolest developers building the latest Actions. Last week, we shared James’ story on GitHub Pages Deploy. This week we have Shivam Mathur. He built an Action to help you with all your PHP applications. Read all about his Action, how he got started, and some of his inspiration.

Action for PHP

Shivam was lucky enough to learn programming at high school. From there he went on to study computer science at university; there he learned PHP and JavaScript. It was probably his proficiency in PHP which drew him to this PHP Action. Even before Actions was released, Shivam was automating:

During my university days I learned to configure servers, deploy the website code, and tools to automate this process.

Once GitHub Actions was released, it seemed like an easy fit. When we released GitHub Actions, there was no setup actions for PHP. So Shivam built it! Setup-PHP is an Action which creates the required environment to do CI/CD for PHP applications:

It can setup various versions of PHP, along with required extensions, various popular CLI tools used by projects in PHP community, code-coverage drivers and a lot more.

Setup-PHP is one of our top used Actions. It’s used by popular projects like PHPUnit, Composer, Symfony, Laravel and thousands of other projects in the PHP community.

CI/CD for making your life easier

GitHub Actions allows you to automate a variety of tasks. When it was released, lots of actions were setup for popular languages like Python. But there wasn’t anything for PHP. Shivam was inspired by the Setup-Python Action. He had used it before and wanted to build something similar for PHP:

Initially I had built it for personal use and for some of my clients, so I can recommend GitHub Actions to them and save myself repeated work while setting up testing and delivery pipelines. When I shared this with the PHP community, it took off. I had many requests for implementing features and improving it so that it can compete with other CI/CD services in terms of ease of use for PHP projects.

You’ll see from a lot of our developer stories and Action heroes, developers often create things for themselves. They build things to solve personal problems. Very soon, those developers discover many others would also benefit. If you’re thinking of building an Action, start close to home. Think about how to make your life easier. Chances are you’ll end up making other people’s lives easier too!

Open Source and the future

After the success of Setup-PHP, Shivam now plans to make the Action more viable. He wants to build it into a sustainable open source project. Setup-PHP is already cross platform, working on Linux, Ubuntu, and macOS. He also wants to add more support for other Linux distributions and self-hosted runners. Having a cross-platform Action however has it’s challenges:

PHP – unlike some other languages – does not have a unified way of installing things. Each platform has different ways of setting things up and unifying them in a 6-line YAML interface was a good challenge.

But challenges lead to learnings. Shivam says building this Action has taught him how to maintain an open source project. And we encourage you to dive in and learn as well.

Start learning with GitHub Actions

Building an Action can be challenging. It can be hard work. But as Shivam has shown, it can be very rewarding. And it can help make your life a whole lot easier. If you’re keen to get started, head on over to our Learning Lab course to grasp the basics.

Don’t forget, these tools and features are here to make your lives better, thanks to people like Shivam. His Setup-PHP Action is free and available to use on the GitHub Marketplace.

If you liked Shivam’s story, make sure you read up on all our awesome Action Heroes like James, Stefan, and more. Don’t forget to check out how GitHub Actions are being used in the COVID response with the Karuna Project.