Notes on software development

PHP Package

How to create a PHP package. Part 4: Git, tags, packagist

In this chapter, we will push created package to github, talk a little bit about versioning, create first release, and, finally, publish the package on to let the whole world install our library with a composer.


I expect that you already know what git and github are. In a few words: git is a distributed version control system that tracks files changes, and github is a hosting service based on git which also provides other useful features. I also assume that you are already registered on and installed git itself (if not, please, do it).

How to create a PHP package. Part 3: Code style

This is the third part of a series on creating a PHP package. In the previous parts, we created a project and covered it with tests.

This time we will implement a code style check to sure that our code not only works correctly but follows the style requirements. This is especially useful when working in a team and all members follow requirements.

How to create a PHP package. Part 2: PHPUnit

This is the second part of a series on creating a PHP package.

In the previous part, we initialized a project using the composer and wrote the code itself. In this part, we will integrate the PHPUnit into our project and write tests.

Code should be covered with tests. This will help to avoid bugs when modifying the code. When we connect the CI to the repository, tests will run automatically as pull requests are created.

How to create a PHP package. Part 1: Composer

If you created a useful PHP library and want to share it with others or reuse it in your other projects, it will be convenient to pack it into a separate package. In this series of articles, we'll discover how to properly organize code into a reusable package, create a structure of the project, write unit tests, create an automatic code style check, implement CI using github actions, and much more. As an example, we will write step by step a small PHP library for syntax highlighting. It will accept text and return highlighted PHP code.