PHP package generators

For creating PHP packages several best practices has been established, like composer support (ofc) and putting the package on packagist, travis integration, directory organisation, tests, documentation and so on.
For further information i recommend these slides https://laravel-news.com/2015/08/hannes-van-de-vreken-package-development-slides/ which describe the situation very well.

And as we are all lazy, we like generators that scaffold a basic php package layout and luckily there are several out there.
They all differ a bit, so pick your favorite.

I personally like the https://github.com/thephpleague/skeleton package template.
However its branded for the League and you would have to replace all occurences of phpleague with your namespace, which is kinda cumbersome.

So i wrote a yeoman generator which automates this, Check it out here: https://github.com/ivoba/generator-phpleague-skeleton
The generator will inquire your personal and package infos and basically just replace the counterparts in the phpleague skeleton.

If you are a yeoman fanboy, as i am :), there are two more, worth to mention:

https://github.com/T1st3/generator-composer
and
https://github.com/juliangut/generator-barephp

The package layout here doesnt differ much, the main difference is that they come with a grunt build.
So you can use grunt to run f.e. phpDoc generation, phplint, phpunit or all at once on your package with f.e. grunt test.

If you dont like yeoman and want to keep it PHP, the slides i mentioned above show two alternatives:

https://github.com/jonathantorres/construct
https://github.com/franzliedke/studio

Studio seems to be more than a normal generator though. Its rather a managment tool for developing packages.
So if you look for a generator only, Construct is probably the candidate here.

One Reply to “PHP package generators”

Comments are closed.