# Leaf MVC
Leaf MVC is a lightweight and minimal MVC wrapper leaf PHP framework that provides a more scalable and powerful setup for creating web apps and APIs quickly and efficiently. Leaf MVC is also heavily inspired by Ruby on rails, laravel and slim, it provides you the best of these packages and avoids the "not so goods"😁
Also, the lightweight core framework is not always suitable for every use case, which is another reason a scalable setup in the form of Leaf MVC has been created.
# Why Leaf MVC?
There are a variety of tools and frameworks available to you when building a web application. However, we believe Leaf + MVC is the best choice for building modern, full-stack web applications.
# 📚 Shallow learning curve
Whether you are new to PHP or have prior experience with the language, leaf MVC 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. You can learn leaf as you build 🥰
# 🪶 Lightweight
If you have had experience with other MVC frameworks like Laravel, you would notice how simple and straightforward leaf MVC is compared those which need you to learn a whole bunch of their framework specific things. Leaf is light and so is Leaf MVC.
# 💪🏽 Powerful
Leaf MVC 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), commands with aloe (opens new window), MVC tools with MVC core (opens new window) and a ton of other modules (opens new window).
You can quickly create a leaf MVC project with composer (opens new window).
composer create-project leafs/mvc <project-name> v3.x-dev
or with the leaf cli:
leaf create <project-name> --mvc --v3
# Directory Structure
This will create a new leaf MVC project named
<project-name>. Inside the new directory, you should have a structure like this.
The directory structure has had a refresh. We normalized the folder cases to lowercase. Note that this only applies to the default leaf MVC folders. Custom folders will have to follow the class structure as done in earlier versions.
C:. ├───app │ ├───console │ ├───controllers │ │ └───Auth │ ├───database │ │ ├───factories │ │ ├───migrations │ │ └───seeds │ ├───helpers │ ├───models │ ├───routes │ └───views │ ├───components │ └───pages │ └───errors ├───config │ └───command ├───public │ └───assets │ ├───css │ ├───images │ ├───js │ └───sass ├───storage │ ├───app │ │ └───public │ ├───framework │ │ └───views │ └───logs └───vendor
- app: This is where you will mostly be working. It houses all your controllers, command and db files.
- config: This holds all your configuration files.
- lib: You can place your libraries and piece files which you need for your app.
- storage: Storage for your files, images, text, databases...
- vendor: This holds all your dependencies and installed files.
In the project root, you can open up your console tool and type in
php leaf serve
This will start the php web server and load your project at
http://localhost:5500 by default.