r/PHPhelp • u/lindymad • Mar 16 '25
Is there a "Blank Webapp Project" PHP template with a folder structure and template files that gives you the basic infrastructure needed for a new open source project?
I notice that many projects have a particular type of folder structure, e.g. a vendor folder, src folder, app folder, etc., and there are particular ways to structure namespaces and filenames so that autoloading of classes works in an expected way, and you need a config file etc. etc.
I'm wondering if there is a blank project which has the bare bones of this all in place, ready to be filled in, or if people just build out the structure every time?
15
Upvotes
4
u/martinbean Mar 16 '25
What would the “open source project” actually be? A fully functional web application that people upload to their own web servers? Or a library that provides some functionality that people should include in their own web applications?
2
u/identicalBadger Mar 16 '25
Sounds like you’re looking for a framework. There are many
10
u/equilni Mar 16 '25
You can build your own and use it as a template.
You can follow the PDS-Skeleton structure and further review this post on Structuring PHP Projects . Then the composer docs to build the json file as a template
Just note:
vendoris automatically created by Composer. You don't need to create this. Just add it to your gitignore file.appis debatable (see the second link)6
u/eurosat7 Mar 16 '25
Symfony offers some good presets. Laravel, too.
Both have some template bundles you can add for bootstrap or tailwind.
Or:
Feel free to try crell/midy if you need more of a webpage - it's early alpha but charming and might be a good start. It supports one of the best template languages and is very light but extensible.
4
u/phpMartian Mar 16 '25
The structure of a library might be different from a web app.
3
u/colshrapnel Mar 16 '25
It is not clear what you're asking about. Folder structure and filenames is one thing. Bare bones ready to be filled in sounds like another, that hints of a framework, which is indeed being some sort of an empty scaffolding that you fill in with your business logic.
Also, as far as I know, there are no such distinct templates specifically for "open source projects". It's just templates, while what license you will choose for your project is completely irrelevant
3
u/BarneyLaurance Mar 16 '25
There are several. Afail none with a particularly wide usage, but I found one here: https://github.com/biurad/php-starter
There's a repo here that has start projects in many languages : https://github.com/emilybache/starter . PHP version is at https://github.com/emilybache/starter/tree/main/php .
You can also just use the `composer init` command in an empty directory to start your project. It will ask you a series of questions and generate a composer.json config file that will assume you're going to structure your filenames in the standard way to match filenames.
1
u/terremoth Mar 17 '25
I have my own:
https://github.com/terremoth/php-project-template
I find it better than most I saw.
1
u/Skarsburning Mar 17 '25
https://github.com/Djongov/SwiftDashPHP
This is my own template of my own mini-framework that I've developed over the past few years to get me started quickly on some personal project type of apps, but i don't think you will find it easy to use or step right in as i have not had time for documentation, but you can check the structure. I've launched a couple of apps from it and can be used in the cloud.
1
u/SnooRabbits2128 Mar 18 '25 edited Mar 19 '25
I created this lightweight mini-framework https://github.com/berramou/bare
It’s really minimalistic just couple of packages from phpleague
route : routing.
Container: for dependency injection.
Plates: for templates.
Elequont: orm.
I tried to setup best structure pieces from different frameworks out there.
0
u/mvpvpm Mar 16 '25
Following
-3
u/Aggressive_Ad_5454 Mar 16 '25
Laravel.
-3
u/The_rowdy_gardener Mar 16 '25
Laravel starters do exactly this
-4
u/ardicli2000 Mar 16 '25
https://github.com/frozeeen/PHP-file-based-routing
I recently saw this file based router. It is very basic and work like a charm for me.