You are viewing the docs for v3.x RC.

Β  Click here Β for earlier versions.

# Skeleton

Leaf Skeleton is a lightweight and minimal MVC boilerplate for leaf PHP framework that provides a more scalable and powerful setup for creating web apps and APIs quickly and efficiently. Skeleton is simply a boilerplate and so avoids all the rules involved in building with full-featured frameworks like leaf API and leaf MVC.

Skeleton 3.0 comes in with a bunch of fresh functionality, and also features added in v3 (opens new window) of the core Leaf package. You can view all these changes here.

# Why Skeleton?

# πŸ“š Shallow learning curve

Whether you are new to PHP or have prior experience with the language, Skeleton helps you fit right in. All you need to get started with Leaf MVC is basic PHP knowledge and a little familiarity with MVC concepts and leaf itself.

# πŸͺΆ Lightweight

Skeleton is not a framework, it is simply leaf with a few pre-installed modules and a bunch of folders πŸ˜…. This means that it is fast and almost as light as simply building with leaf core.

# πŸ’ͺ🏽 Powerful

Skeleton packs a ton of powerful tools which speed up your development process by folds. You have simple tools and modules like authentication (opens new window), MVC tools with MVC core (opens new window) and a ton of other modules (opens new window).

# Installation

You can quickly create a Skeleton project with composer (opens new window).

composer create-project leafs/skeleton <project-name> v3.x-dev
1

or with the leaf cli:

leaf create <project-name> --skeleton --v3
1

# Directory Structure

This will create a new Skeleton project named <project-name>. Inside the new directory, you should have a structure like this.

Note

The directory structure has had a refresh. We normalized the folder cases to lowercase. Note that this only applies to the default Skeleton folders. Custom folders will have to follow the class structure as done in earlier versions.

C:.
β”œβ”€β”€ config
β”‚   β”œβ”€β”€ app.php
β”‚   β”œβ”€β”€ auth.php
β”‚   β”œβ”€β”€ cors.php
β”‚   β”œβ”€β”€ database.php
β”‚   β”œβ”€β”€ paths.php
β”‚   └── view.php
β”œβ”€β”€ controllers
β”‚   β”œβ”€β”€ Controller.php
β”‚   └── TestsController.php
β”œβ”€β”€ models
β”‚   β”œβ”€β”€ Model.php
β”‚   └── Test.php
β”œβ”€β”€ pages
β”‚   β”œβ”€β”€ body.view.php
β”‚   β”œβ”€β”€ components
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ styles.css
β”‚   └── test.view.php
β”œβ”€β”€ routes
β”‚   β”œβ”€β”€ _app.php
β”‚   └── index.php
β”œβ”€β”€ storage
β”‚   β”œβ”€β”€ app
β”‚   β”œβ”€β”€ framework
β”‚   └── logs
β”œβ”€β”€ vendor
└── index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  • config: This holds all your configuration files.
  • controllers: This directory holds all your controllers
  • models: This holds all your models
  • pages: This holds all your views
  • routes: This holds all your routes
  • storage: Storage for your files, images, text, databases...
  • vendor: This holds all your dependencies and installed files.

Directory Structure

Skeleton is 100% customizable. You can rearrange the directories to match your preference. Simply reconfigure the directories in config/paths.php

In the project root, you can open up your console tool and type in

php leaf serve
1

This will start the php web server and load your project at http://localhost:5500 by default.