Skeleton
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.
Installation
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.
Directory Structure
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 config.php
file.
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
The
config
directoryThe
config
directory 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.The
controllers
directoryThe
controllers
directory 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.The
models
directoryThe
models
directory 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.The
pages
directoryThe
pages
directory contains the views and frontend assets for your Leaf application.The
routes
directoryThe
routes
directory 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.The
storage
directoryThe
storage
directory 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.
The
vendor
directoryThe
vendor
directory contains all the dependencies installed by Composer. It's automatically generated when you install the dependencies using Composer.
Next Steps
Follow along with the next steps to learn more about Skeleton.