Skeleton is a minimal but powerful MVC boilerplate built on top of Leaf. It's designed to be simple, fast and easy to use. It is meant to bring structure to your Leaf workflow without forcing you to stick to any framework. It is a good starting point for building lightweight applications using the MVC pattern.
Leaf MVC vs Leaf API vs Skeleton
Leaf offers three setups for you to choose from. You can find more information about these setups in the MVC section.
The easiest way to setup Skeleton is to use the Leaf CLI:
leaf create <project-name> --skeleton --v3
You can also setup a Skeleton app by using Composer:
composer create-project leafs/skeleton <project-name>
This command will set up a Skeleton app in the
<project-name> directory. You can then run the app using the Leaf CLI:
cd <project-name> leaf serve
Or the built-in PHP server:
cd <project-name> php -S localhost:8000
You should then see the welcome page in your browser.
The Skeleton directory structure is setup to be straighforward and understandable at a glance. You can completely change the directory structure to suit your needs, just be sure to update the paths in the
For a fresh Skeleton app, the directory structure looks like this:
C:. ├── config ├── controllers ├── models ├── pages │ └── components ├── routes ├── storage │ ├── app │ │ └── public │ ├── framework │ │ └── views │ └── logs └── vendor
configdirectory contains the configuration files for your application. These are used to configure how Leaf and it's modules interact with your application. You can find more information about the configuration files in the Configuration section.
controllersdirectory contains the controllers for your application. These are used to handle HTTP requests. You can find more information about the controllers in the Controllers section.
modelsdirectory contains the models for your application. These are used to interact with the database. You can find more information about the models in the Models section.
pagesdirectory contains the views and frontend assets for your Leaf application.
routesdirectory contains routes for your application. These are used to map HTTP requests to controllers. You can find more information about the routes in the Routing section.
storagedirectory contains the compiled views, logs and other files generated by your application. It's divided into a few sub-directories:
app- Contains the files generated by your application. This includes the compiled views and the files uploaded by users.
framework- Contains the framework generated files for your application.
logs- Contains the log files generated by your application.
vendordirectory contains all the dependencies installed by Composer. It's automatically generated when you install the dependencies using Composer.
Follow along with the next steps to learn more about Skeleton.