A simple PHP Template Project with boilerplate code to start with
- bootstrap
- app.php: Library loader which autoloads and set-ups all the used Packages
- controllers
- HomeController.php: A sample Controller file
- public
- index.php: The hosted file.
- .env.example: Sample environment file
- .gitignore
- LICENCE
- README.md
- composer.json: Composer file with all dependencies
- composer.lock
- helpers.php: Helper library which is autoloaded in composer.json file
- routes.php: File which contains all the routes for the application
- vlucas/phpdotenv
- For loading Environment settings from a .env file in Project root directory.
- nikic/FastRoute
- Router used in the Application.
composer install # Installing dependencies
cp ./.env.example ./.env # Creating environment file
cd ./public && php -S localhost:8001 # Hosting the application on port 8001
Visit: http://localhost:8001 to se it in action.
- Add the route in routes.php, refer to sample route for help.
- Add the method in controllers/HomeController or you can create your own controller file in the same folder.
- Navigate to your route.
This project started as a simple minimal PHP boilerplate to get started with a PHP project. A project which will provide you basic routing and environment settings with basic folder structure like an open canvas giving you freedom to add any dependencies that you may require and even change the folder structure as you please. No restriction a simple template for your PHP project.