Getting Started with Leaf PHP🍀
Leaf PHP🍀 is a modern PHP framework that allows you to create clean, simple but powerful web applications and APIs quickly and easily. First of all, let’s understand what a framework is.
A framework is a ready made “library” that basically gives you a particular structure for your apps, along with functionality…it basically makes your coding life much easier. You can read more on frameworks here.
So, now that we understand what a framework is, let’s try to explain better what Leaf PHP is. Per our definition above, Leaf is a ready made “library” that gives us a particular structure to follow as we build our apps. It also comes with a ton of functionality which will speed up our development and make life easier for us😅😅
Leaf PHP is one of the very young PHP frameworks out there, as it was first released on 14th October, 2019. Hence, it’s not as famous as others like Laravel and Slim, however, Leaf is just as resourceful. You can check out the official docs here.
Working with Leaf or any other PHP framework is just like working with the PHP language itself, therefore, you must have some knowledge on raw PHP first.
Let’s talk about Installation
The recommended way of installing Leaf PHP is through composer. You can download composer here. After installing composer, run this in your command shell:
composer require leafs/leafThis will install Leaf PHP into your project directory’s vendor folder:vendor/leafs
With this, you can start building your app.
You can also check out the Leaf PHP quick starters for your project type, these give you a setup for the kind of project you’re working on
For an MVC project, you can use the Leaf MVC package which you can also install with composer
composer create-project leafs/mvc my-mvc-appThere’s also a quickstart for API development, you can get this with
composer create-project leafs/api-starter my-api