Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily.

Overview



Leaf PHP Framework



Leaf PHP

Latest Stable Version Total Downloads License

Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily. Leaf introduces a cleaner and much simpler structure to the PHP language while maintaining it's flexibility. With a simple structure and a shallow learning curve, it's an excellent way to rapidly build powerful and high performant web apps and APIs.

Installation

You can easily install Leaf using Composer.

composer require leafs/leaf

This will install Leaf in your project directory.

Basic Usage

This is a simple demonstration of Leaf's simplicity. After installing Leaf, create an index.php file.

connect("host", "user", "pass", "db name"); // Base example $app->get("/", function() use($app) { $app->response()->json([ "message" => "Welcome!" ]); }); // Full login example $app->post("/auth/login", function() use($app, $auth) { $credentials = $app->request()->get(["username", "password"]); $user = $auth->login("users", $credentials, [ "username" => ["username", "max:15"], "password" => ["text", "NoSpaces", "min:8"], ]); if (!$user) { $app->response()->throwErr($auth->errors()); } $app->response()->json($user); }); $app->run(); ">

require __DIR__ . "vendor/autoload.php";

$app = new Leaf\App;
$auth = new Leaf\Auth;

$auth->connect("host", "user", "pass", "db name");

// Base example
$app->get("/", function() use($app) {
  $app->response()->json([
    "message" => "Welcome!"
  ]);
});

// Full login example
$app->post("/auth/login", function() use($app, $auth) {
  $credentials = $app->request()->get(["username", "password"]);

  $user = $auth->login("users", $credentials, [
    "username" => ["username", "max:15"],
    "password" => ["text", "NoSpaces", "min:8"],
  ]);

  if (!$user) {
    $app->response()->throwErr($auth->errors());
  }

  $app->response()->json($user);
});

$app->run();

You may quickly test this using the built-in PHP server:

php -S localhost:8000

You can view the full documentation here

Working With MVC

Leaf has recently added a new package to it's collection: LeafMVC. It's an MVC framework built with this package at it's core that let's you create clean, simple but powerful web applications and APIs quickly and easily.

Checkout LeafMVC here

Working with API

Leaf also added a simple framework constructed in an MVCish way, but without the View layer purposely for creating APIs and Libraries. Leaf terms this construct as MRRC(Model Request Response Controller ๐Ÿ˜… ๐Ÿ˜… ๐Ÿ˜… ). This let's you seperate API logic, data and "views"(request and response) just like how it's done in MVC.

Checkout the LeafAPI package here

Skeleton

Skeleton is the latest package included in the Leaf family. Skeleton is a customizable and simple to use boilerplate powered by Leaf. Skeleton gives you the power of other setups like Leaf MVC without the restrictions of those full blown frameworks. Use and contribute to Skeleton

Of course, with this core package, you can build your app in any way that you wish to as Leaf contains all the required functionality to do so

View Leaf's docs here

Built with โค by Mychi Darko

Comments
  • Fatal error: Uncaught InvalidArgumentException: Unsupported driver

    Fatal error: Uncaught InvalidArgumentException: Unsupported driver

    I am a Chinese user, can not speak English, or a PHP rookie, this is using Google automatic translation, I apologize first. I encountered an error using the model, What did I do wrong?

    Fatal error: Uncaught InvalidArgumentException: Unsupported driver

    My program code:

    App\Controllers\UserController.php

    namespace App\Controllers;
    
    use Leaf\Controller;
    use App\Models\User;
    
    class UsersController extends Controller
    {
        public function index()
        {
            $users = User::all();
            foreach ($users as $user) {
                echo $user->name;
            }
        }
    

    App\Models\User.php

    namespace App\Models;
    
    use Leaf\Model;
    
    class User extends Model
    {
        protected $table = 'users';
        public $timestamps = false;
    }
    

    My database connection๏ผš

    $db = new Leaf\Db("localhost", "root", "root", "demo");
    
    opened by wfsdaj 10
  • Composer Doesn't Load

    Composer Doesn't Load

    v1.5.0

    Fatal error: Uncaught Error: Class 'Leaf\Core\Leaf' not found in /var/www/html/portal/index.php:58 Stack trace: #0 {main} thrown in /var/www/html/portal/index.php on line 58

    $leaf = new Leaf\Core\Leaf;

    All other composer packages in vendors are working fine.

    opened by ideerge 10
  • Logger not working

    Logger not working

    Describe the bug Looks like the logger is not working, followed the instructions in the doc.

    To Reproduce Just by adding this line, to test the logger : app()->logger()->info('Hello');

    Expected behavior It should create and write the log file (it is enabled and well defined in config/app.php, I'm using the core template v3), and yes "leafs/logger" is installed via composer.

    Additional context The error : ` Error thrown with message "Cannot use object of type Leaf\Helpers\Container as array"

    Stacktrace: leafsphp/leaf#10 Error in /app/vendor/leafs/leaf/src/App.php:168 leafsphp/leaf#9 Leaf\App:Leaf{closure} in /app/vendor/leafs/leaf/src/Helpers/Container.php:223 leafsphp/leaf#8 Leaf\Helpers\Container:Leaf\Helpers{closure} in /app/vendor/leafs/leaf/src/Helpers/Container.php:67 leafsphp/leaf#7 Leaf\Helpers\Container:get in /app/vendor/leafs/leaf/src/App.php:210 leafsphp/leaf#6 Leaf\App:__get in /app/vendor/leafs/leaf/src/App.php:292 leafsphp/leaf#5 Leaf\App:logger in /app/app/controllers/BrainController.php:25 leafsphp/leaf#4 App\Controllers\BrainController:facial in /app/vendor/leafs/router/src/Router/Core.php:489 leafsphp/leaf#3 call_user_func_array in /app/vendor/leafs/router/src/Router/Core.php:489 leafsphp/leaf#2 Leaf\Router\Core:invoke in /app/vendor/leafs/router/src/Router/Core.php:455 leafsphp/leaf#1 Leaf\Router\Core:handle in /app/vendor/leafs/router/src/Router/Core.php:386 #0 Leaf\Router\Core:run in /app/public/index.php:130 `

    opened by agarzon-orangerine 6
  • Nested mounts example

    Nested mounts example

    How do they work? I keep getting ArgumentCountError Too few arguments to function {closure}(), 0 passed and exactly 1 expected

    $leaf->mount('/user', function() use ($leaf, $response, $twig) {
    
        $leaf->get('/', function() use($response) {
            echo $response->renderMarkup('<p>no user id</p>');
        });
    
        // will result in '/movies/id'
        $leaf->mount('/(\d+)', function($id) use ($leaf, $response, $twig) {
    
            echo $response->renderMarkup("<p>user {htmlentities($id)}</p>");
    
            $leaf->get('/', function() use($response) {
                //do something
            });
    
        });
    
    });
    
    opened by aolko 6
  • debug  = false not worked as expected

    debug = false not worked as expected

    If you try to disable debug mode to not show code or more details on-screen when you got an error 500, the .env

    APP_DEBUG=false

    or instruction

    app()->config('debug',false)

    will not prevent the nice debug screen to show up.

    Screen Shot 2022-09-26 at 2 18 30 PM

    opened by swimitup 5
  • Response from GET Request Return as Null

    Response from GET Request Return as Null

    Hi there,

    We're following the main tutorial to obtain the GET parameter from the URL and output it to a JSON response.

    $app->get("/user", function() use($app) {
    
      $name = $app->request()->get("name");
      $app->response()->json([
        "name" => $name,
        "day" => "test"
      ]);
    
    });
    

    Expected response should be like this: curl -X GET http://localhost/user?name=test

    {
        "name": test,
        "day": "test"
    }
    

    But it keeps throwing out null as the response.

    {
        "name": null,
        "day": "test"
    }
    

    More information: php-7.4.16 / nginx 1.18.0

    Thank you.

    opened by randytan 5
  • Leaf Request error when sending json object as data

    Leaf Request error when sending json object as data

    It seems that Leaf Request doesn't handle json object as data. For example, with this payload: { name: toto age: 20 address: { name: 'my road' number: 18 town: 'Paris' } }

    I get this fatal error: Uncaught ErrorException: htmlspecialchars() expects parameter 1 to be string, array given in C:\wamp64\www\api.mecadrive\Leaf\Http\Request.php on line 242

    Is there any way to access these values with someting like: $request->get('address')->get('town'); // Paris or

    $request->get('address');
    $request['town']; // Paris
    

    Thank's for the job !

    opened by chatelain 5
  • Cannot use object of type Leaf\Exceptions\FrameCollection as array

    Cannot use object of type Leaf\Exceptions\FrameCollection as array

    Describe the bug An error occurs when generating an error: Cannot use object as array in /vendor/leafs/exception/src/Exceptions/Inspector.php:219.

    https://github.com/leafsphp/exceptions/blob/9f9728a7cbd01c1a51697dc8272a621856436f6b/src/Exceptions/Inspector.php#L219

    To Reproduce

    <?php
    
    // Undefined variable $var2.
    $var1 = count($var2);
    

    image

    Expected behavior I was expecting the following error: image

    Additional context I temporarily fixed it like this, but it needs review and testing:

    <?php
    
    219   if ( 0 < $newFrames->count() ) {
    220       $newFrames->offsetGet( 0 )->addComment(
    221           $previousInspector->getExceptionMessage(),
    222           'Exception message:'
    223       );
    224   }
    
    opened by jeis4n 4
  • Unable to start using application

    Unable to start using application

    After fresh installation via composer leaf is not working. Using example code:

    <?php
    
    require __DIR__ . "/vendor/autoload.php";
    
    app()->get("/", function () {
      response()->json(["message" => "Hello World!"]);
    });
    
    app()->run();
    

    Getting:

    PHP Fatal error: Uncaught Error: Call to undefined function app()

    Paths are correct. Application just does not work. Using latest version: 3.0 RC2.

    P.S. Does the phpmailer should exist by default in 'vendor' directory if I did not install 'mail' module?

    opened by ponasromas 4
  • Database connection wrong documentation

    Database connection wrong documentation

    Hey guys, great framework. I just start to using it and must say, it is great job!

    The documentation using db module is wrong.

    $db->connect('127.0.0.1', 'username', 'password', 'dbname');

    Need to be:

    $db->connect('127.0.0.1', 'dbname', 'username', 'password');

    The other things working just fine, I'm testing and building my app on this.

    Thanks!

    ๐Ÿ“š documentation ๐Ÿ leaf3 
    opened by InfinitumForm 3
  • Request > Paths

    Request > Paths

    I'm looking at the "Paths" section here: https://leafphp.netlify.app/#/leaf/v/2.5.0/http/request

    As far as I can see the methods for "getRootUri" and "getResourceUri" have yet to be implemented? Is that correct?

    ๐Ÿ“š documentation 
    opened by jamie-syon 3
Releases(v3.2.2-beta)
  • v3.2.2-beta(Dec 25, 2022)

    v3.2.2-beta - 25 Dec 2022

    Added

    • Added support for Eien websockets

    Fixed

    • Fixed non-static methods error
    • Fixed issue with CSRF error

    Removed

    • Removed obsolete code
    Source code(tar.gz)
    Source code(zip)
  • v3.2.1(Oct 23, 2022)

  • v3.2.0(Oct 3, 2022)

  • v3.1.1(Sep 10, 2022)

  • v3.1.0(Aug 11, 2022)

  • v3.0.1(May 29, 2022)

  • v3.0(Apr 15, 2022)

    v3.0 - 15 Apr, 2022

    Added

    • Added support for global functions
    • Added unit tests
    • Added pestphp
    • Added more support for configuring with env variables.
    • Added script method on app to handle modes.
    • Added automatic loading for major modules.
    • Added CSRF handler.
    • Added autoloading for the CSRF module
    • Added CORS handler for leafs/cors
    • Updated error pages
    • Added .env precedence over local config
    • Added support for recursive config
    • Added support for nested config
    • Added support for custom setting groups
    • Switched to leaf exceptions

    Fixed

    • Fixed PHP 7.3 unsupported types
    • Created a standard for functional mode
    • Revamped error pages
    • Fixed potential type errors
    • Fixed malformed JWT error on auth module
    • Added single state for container settings and leaf config
    • Fixed breaks in PHP 8+

    Changed

    • You no longer need to initialize Leaf.
    • Moved Leaf\Http namespace to HTTP module
    • Moved base controller, model, database and to mvc-core module
    • Disabled logging by default
    • Moved bareui, fs, auth, form, cookies, session, db and date into modules
    • Moved Leaf\Router into installable modules.
    • Changed leaf router add to use
    • Tied leaf router directly to Leaf\App
    • Upgraded all dependencies
    • Added strict types

    Removed

    • Removed unused dependencies
    • Removed experimental features
    • Removed unused initializers
    • Removed evadeCors method on leaf
    • Removed Leaf\Router::getRequestMethod
    • Removed unnecessary code to improve performance
    • Removed app instance on middleware
    • Removed unused helper functions
    • Removed leftover files from clean up
    Source code(tar.gz)
    Source code(zip)
  • v3.0-rc.2(Jan 27, 2022)

    v3.0 (Release Candidate 2) - 27 Jan, 2022

    Added

    • Added support for global functions
    • Added unit tests
    • Added pestphp
    • Added more support for configuring with env variables.
    • Added script method on app to handle modes.
    • Added automatic loading for major modules.
    • Added CSRF handler.
    • Added autoloading for CSRF module
    • Added CORS handler for leafs/cors
    • Updated error pages
    • Added .env precedence over local config
    • Added support for recursive config
    • Added support for nested config
    • Added support for custom setting groups
    • Switched to leaf exceptions

    Fixed

    • Fixed PHP 7.3 unsupported types
    • Created a standard for functional mode
    • Revamped error pages
    • Fixed potential type errors
    • Fixed malformed JWT error on auth module
    • Added single state for container settings and leaf config
    • Fixed breaks in PHP 8+

    Changed

    • You no longer need to initialize Leaf.
    • Moved Leaf\Http namespace to Http module
    • Moved base controller, model, database and to mvc-core module
    • Disabled logging by default
    • Moved bareui, fs, auth, form, cookies, session, db and date into modules
    • Moved Leaf\Router into installable module.
    • Changed leaf router add to use
    • Tied leaf router directly to Leaf\App
    • Upgraded all dependencies
    • Added strict types

    Removed

    • Removed unused dependencies
    • Removed experimental features
    • Removed unused initializers
    • Removed evadeCors method on leaf
    • Removed Leaf\Router::getRequestMethod
    • Removed unnecessary code to improve performance
    • Removed app instance on middleware
    • Removed unused helper functions
    • Removed left over files from clean up
    Source code(tar.gz)
    Source code(zip)
  • v3.0-rc(Dec 10, 2021)

    v3.0 (Release Candidate) - 10 December

    Added

    • Added support for global functions
    • Added more support for configuring with env variables.
    • Added script method on app to handle modes.
    • Added automatic loading for major modules.
    • Added CSRF handler.
    • Added autoloading for CSRF module
    • Added CORS handler for leafs/cors
    • Updated error pages
    • Added .env precedence over local config

    Fixed

    • Fixed PHP 7.3 unsupported types
    • Created a standard for functional mode
    • Revamped error pages
    • Fixed potential type errors
    • Fixed malformed JWT error on auth module

    Changed

    • You no longer need to initialize Leaf.
    • Moved Leaf\Http namespace to Http module
    • Moved base controller, model, database and to mvc-core module
    • Disabled logging by default
    • Moved bareui, fs, auth, form, cookies, session, db and date into modules
    • Moved Leaf\Router into installable module.
    • Changed leaf router add to use
    • Tied leaf router directly to Leaf\App
    • Upgraded all dependencies

    Removed

    • Removed unused dependencies
    • Removed experimental features
    • Removed unused initializers
    • Removed evadeCors method on leaf
    • Removed Leaf\Router::getRequestMethod
    • Removed unnecessary code to improve performance
    • Removed app instance on middleware
    • Removed unused helper functions
    Source code(tar.gz)
    Source code(zip)
  • v3.0-beta(Nov 27, 2021)

    v3.0 (Beta) - 27 November

    Added

    • Added support for global functions
    • Added more support for configuring with env variables.
    • Added script method on app to handle modes.
    • Added automatic loading for major modules.
    • Added CSRF handler.
    • Added autoloading for CSRF module
    • Added CORS handler for leafs/cors
    • Updated error pages
    • Added .env precedence over local config

    Fixed

    • Fixed PHP 7.3 unsupported types
    • Created a standard for functional mode
    • Revamped error pages
    • Fixed potential type errors

    Changed

    • You no longer need to initialize Leaf.
    • Moved Leaf\Http namespace to Http module
    • Moved base controller, model, database and to mvc-core module
    • Disabled logging by default
    • Moved bareui, fs, auth, form, cookies, session, db and date into modules
    • Moved Leaf\Router into installable module.
    • Changed leaf router add to use
    • Tied leaf router directly to Leaf\App
    • Upgraded all dependencies

    Removed

    • Removed unused dependencies
    • Removed experimental features
    • Removed unused initializers
    • Removed evadeCors method on leaf
    • Removed Leaf\Router::getRequestMethod
    • Removed unnecessary code to improve performance
    • Removed app instance on middleware
    • Removed unused helper functions
    Source code(tar.gz)
    Source code(zip)
  • v3.0-alpha(Nov 10, 2021)

    v3.0 (Preview) - 10 November

    Added

    • Added support for global functions
    • Added more support for configuring with env variables.
    • Added script method on app to handle modes.
    • Added automatic loading for major modules.
    • Added CSRF handler.
    • Added autoloading for CSRF module
    • Added CORS handler for leafs/cors
    • Updated error pages
    • Added .env precedence over local config

    Fixed

    • Fixed PHP 7.3 unsupported types
    • Created a standard for functional mode
    • Revamped error pages
    • Fixed potential type errors

    Changed

    • You no longer need to initialize Leaf.
    • Moved Leaf\Http namespace to Http module
    • Moved base controller, model, database and to mvc-core module
    • Disabled logging by default
    • Moved bareui, fs, auth, form, cookies, session, db and date into modules
    • Moved Leaf\Router into installable module.
    • Changed leaf router add to use
    • Tied leaf router directly to Leaf\App
    • Upgraded all dependencies

    Removed

    • Removed unused dependencies
    • Removed experimental features
    • Removed unused initializers
    • Removed evadeCors method on leaf
    • Removed Leaf\Router::getRequestMethod
    • Removed unnecessary code to improve performance
    • Removed app instance on middleware
    • Removed unused helper functions
    Source code(tar.gz)
    Source code(zip)
  • v2.6.0(Sep 19, 2021)

    v2.6.0 - โšฐ๏ธ The Goodbye Flower - 20th September, 2021

    Added

    • Added UUID support to Leaf Auth
    • Added support for custom id keys in Leaf Auth

    Fixed

    • Fixed Request::getUrl
    • Fixed issue #53
    • Fixed Database

    Removed

    • Removed Leaf blade component
    Source code(tar.gz)
    Source code(zip)
  • v2.5.1(May 30, 2021)

    v2.5.1 - ๐Ÿ’  Lilac - 30th May, 2021

    Fixed

    • Fixed PHP 7.3 unsupported types
    • Fixed server base path on router
    • Fixed bare UI config method
    • Fixed faker namespace

    Changed

    • Removed BETA flag from Leaf password helper

    Removed

    • Removed Leaf blade component
    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(Apr 27, 2021)

    v2.5.0 - ๐Ÿ’  Gladiolus - 27th April, 2021

    Added

    • Leaf debug now controls error reporting (you don't want nasty errors showing in production)
    • Added Request::try
    • Added app.down config
    • Added Leaf app instance on Config
    • Added grouped namespaces to router
    • Added single route namespaces
    • Added named routes to router
    • Added router push for switching between pages
    • Added more customizations on Leaf\Database
    • Added simple flash messaging with Leaf\Flash
    • Added flash method to session
    • Added HTTP caching on Leaf\Http\Headers

    Fixed

    • Fixed inverted condition for showing default development/production error pages.
    • Fixed router hooks
    • Added proper types on App and Router
    • Added proper controller and missing method warnings
    • Fixed incorrect method labeling
    • Fixed HTTP caching issues
    • Fixed app logger and app log writer
    • Fixed app break after non-existent middlware call

    Changed

    • Switched debugging controls from mode to debug
    • Default 404 page now automatically loaded
    • Router middleware App instance now automatically loaded
    • Added null response for unset session variables
    • Leaf error handler now loads on App init
    • Default error 500 handler now automatically loaded
    • Updated leaf container

    Removed

    • Removed unnecessary code from App
    • Removed app name
    • Removed view method on app and router
    • Removed previous hook support on app
    • Removed unused router config
    • Removed Leaf environment class
    • Removed unused default middleware
    • Leaf\Blade no longer comes with Leaf by default.
    • Removed status and contentType on Leaf\App
    Source code(tar.gz)
    Source code(zip)
  • v2.5.0-beta(Apr 16, 2021)

    v2.5.0-beta - ๐Ÿ’  Gladiolus (BETA) - Apr 16, 2021

    Added

    • Added app.down config
    • Added Leaf app instance on Config
    • Added grouped namespaces to router
    • Added named routes to router
    • Added router group prefixes
    • Added router push for switching between pages
    • Added more customizations on Leaf\Database
    • Added simple flash messaging with Leaf\Flash
    • Added flash method to session
    • Added HTTP caching on Leaf\Http\Headers

    Fixed

    • Fixed router hooks
    • Added proper types on App and Router
    • Added proper controller and missing method warnings
    • Fixed incorrect method labeling
    • Fixed HTTP caching issues
    • Fixed app logger and app log writer
    • Fixed app break after non-existent middlware call

    Changed

    • Default 404 page now automatically loaded
    • Router middleware App instance now automatically loaded
    • Added null response for unset session variables
    • Leaf error handler now loads on App init
    • Default error 500 handler now automatically loaded
    • Updated leaf container

    Removed

    • Removed unnecessary code from App
    • Removed app name
    • Removed view method on app and router
    • Removed previous hook support on app
    • Removed unused router config
    • Removed Leaf environment class
    • Removed unused default middleware
    • Leaf\Blade no longer comes with Leaf by default.
    • Removed status and contentType on Leaf\App
    Source code(tar.gz)
    Source code(zip)
  • v2.4.4(Mar 23, 2021)

    v2.4.4 - ๐ŸŽ‹ Common Reed - 23rd March 2021

    Added

    • Added Leaf\Config for easier configuration
    • Added new leaf config options
    • Added Leaf\View
    • Added support for multiple template engines concurrently
    • Added BareUI templating engine

    Fixed

    • Internal code improvements on App

    Changed

    • No renames, restructures, ...

    Removed

    • No removals
    Source code(tar.gz)
    Source code(zip)
  • v2.4.3(Feb 26, 2021)

    v2.4.3 - ๐ŸŽ‹ Giant Cane Grass - 26th February 2021

    Added

    • Updated Leaf\Db and Leaf\Auth to throw dev errors to Leaf's error handler for better error reporting

    Fixed

    • Organized methods in Leaf\FS

    Changed

    • Made Leaf\Http\Response static
    • Made Leaf\Http\Request static

    Removed

    • No removals
    Source code(tar.gz)
    Source code(zip)
  • v2.4.2(Feb 3, 2021)

    v2.4.2 - ๐Ÿฅฌ Desert Wishbone-bush - 3rd February 2021

    This version of Leaf continues the goal of making Leaf features more flexible and increasing usability.

    Added

    • Added option to turn off experimental method warnings

    • Added Form::rule which allows you to create your own rules for form validation.

    Form::rule("max", function($field, $value, $params) {
        if (strlen($value) > $params) {
            Form::addError($field, "$field can't be more than $params characters");
            return false;
        }
    });
    
    • Added internal Leaf\Form feature which allows you to pass parameters to validation rules.
    $validation = Form::validate([
        // To pass a param to a rule, just use :
        "username" => "max:3",
    ]);
    
    • Added Form::addError which allows you to add errors to be returned in Form::errors()
    Form::addError($field, "$field can't be more than $params characters");
    
    • Added max and min rules by default
    $validation = Form::validate([
        "username" => "max:1",
        "password" => "min:81",
    ]);
    
    • Guards can be used even in API mode. This will alert you if you're not eligible to view a particular page.

    Fixed

    • Updated dependencies with security patches

    • Fixed multiple validation breaks from v2.4.2 beta.

    Changed

    • Made Leaf\Form methods static. They can now be called from anywhere within your Leaf app.

    Removed

    • No removals
    Source code(tar.gz)
    Source code(zip)
  • v2.4.2-beta(Jan 20, 2021)

    v2.4.2 [BETA] - ๐Ÿฅฌ Desert Wishbone-bush (Beta) - 20th January 2020

    This release mainly focuses on security patches for all Leaf based libraries. It contains updated dependencies and internal code patches to make your apps even more secure.

    Added

    • No additions

    Fixed

    • Updated dependencies with security patches

    Changed

    • Made Leaf\Auth methods static. They can now be called from anywhere within your Leaf app.

    Removed

    • No removals
    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Jan 12, 2021)

    v2.4.1 - ๐Ÿ Marvel-of-peru - 12th January 2020

    Added

    • Added Session auth support out of the box

    Fixed

    • Fixed app down bug
    • Fixed known bugs

    Changed

    • Separated Router module from app module
    • Made session methods static

    Removed

    • Removed app down feature
    Source code(tar.gz)
    Source code(zip)
  • v2.4.0-beta(Nov 30, 2020)

    v2.4.0 - BETA - 30th November, 2020

    Unlike previous versions, this version of Leaf is focusing on improving the use of existing features, rather than just pumping new magic into Leaf. It has a lot of bug fixes, standardization of method names and overall upgrades.

    Added

    • Added App::evadeCors
    • Added App::routes to preview all routes
    • Added Db::first()
    • Leaf DB can now detect query type even when query
    • Added orWhere, whereLike, orWhereLike like, orLike, orderBy, all limit and LIKE helpers to Leaf Db
    • Added new format to Date::now
    • Added Auth::update
    • Added custom token lifetime support on Auth
    • Added Auth settings to allow easy and more detailed customizations
    • Added token lifetime support on Helpers\Authentication
    • Added support for app down for maintainance

    Fixed

    • Fixed login bug with Auth::currentUser
    • Fixed Leaf DB same value bug
    • Minor fixes on Auth::login and Auth::register

    Changed

    • Switched methods to camel case
    • Renamed Auth::useToken to Auth::id
    • Renamed Auth::currentUser to Auth::user
    • Made Helpers\JWT and Helpers\Authentication methods static
    • Methods return null instead of false in case of unexpected results

    Removed

    • Removed Form::isEmpty and Form::isNull
    • Removed deprecated methods from Response
    • Removed deprecated methods from Date

    This list is still being updated.

    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Aug 15, 2020)

    v2.3.0 - 15th August, 2020

    ๐Ÿ“‘ Added

    • Added Leaf\Auth::useToken
    • Added Leaf\FS::upload_file
    • Added manual init to Leaf\Session
    • Added option for status code messages
    • Added callable utils
    • Added session encoding/decoding
    • Leaf\Http\Request now catches files passed into request
    • Added Leaf\Http\Request::typeIs
    • Leaf\Http\Request::get can now return multiple request data at once
    • Added Leaf\Http\Request::files
    • New Leaf\Http\Headers package
    • More untracked additions

    ๐Ÿ”ง Fixed

    • fixed Leaf\Http\Headers
    • Fixed response http status codes bug
    • Fixed header integration with response
    • Fixed header reliance on Set
    • Fixed throwErr code error
    • Fixed Leaf\Session package
    • Fixed response redirect
    • Fixed Leaf\Http\Request::body bugs
    • Sessions return false instead of throwing errors (Fix for web apps)
    • FS returns false instead of throwing errors
    • Fixed up Leaf\Http\Request::params
    • Fixed up Leaf\Http\Request::hasHeader
    • Fixed up header related methods on Leaf\Http\Request
    • Fixed bugs on Leaf\Environment
    • More untracked fixes

    ๐ŸŽˆ Changed

    • Switched Leaf\Session to native PHP sessions
    • Switched session package in Leaf\App
    • Changed controller file uploads to Leaf\FS
    • Leaf\Date methods can now be called static-ly
    • Switched Leaf\Date methods to camel case, but with backward compatability for snake_case
    • Made all Leaf\FS methods static

    ๐Ÿšš Removed

    • Removed old session code
    • Removed setEncryptedCookie and getEncryptedCookie on Leaf\App
    • Slashed unnecessary code from Leaf\Http\Request
    • Slashed unnecessary code from Leaf\Http\Session
    • Slashed unnecessary code from Leaf\Http\Cookie
    • Slashed unnecessary code from Leaf\Http\Response
    • Removed all method type tests from Leaf\Http\Request
    Source code(tar.gz)
    Source code(zip)
  • v2.2.0-beta(Jul 7, 2020)

    v2.2.0 [BETA] - 7th July, 2020

    Added

    • Added Leaf\Auth::currentUser
    • Added new cookies package relying on PHP's setcookie

    Fixed

    • fixed hidden fields on Leaf\Auth::login
    • Fixed multiple-request type data on get and body at Leaf\Http\Request

    Changed

    • Switched cookies package in Leaf\Http\Response
    • Switched cookies package in Leaf\App

    Removed

    • Removed old cookies package and all it's methods
    • Removed setEncryptedCookie and getEncryptedCookie on Leaf\App
    • Slashed unnecessary code from Leaf\Http\Request
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Jun 22, 2020)

    v2.1.0 - 22nd June, 2020

    Added

    • Added Leaf\Auth::auto_connect
    • Added default bypass for CORS errors
    • Added Mysqli::auto_connect
    • Added optional db_type option to Leaf\Db\PDO connection
    • Added PDO::auto_connect
    • Added new db module (Leaf\Db)

    Changed

    • Switched default db to Leaf\Db

    Removed

    • Removed Leaf\Wynter
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0-alpha(May 24, 2020)

    Changelog

    v2.1.0 - alpha - 24th May, 2020

    Added

    • Added Route::resource
    • Added Session::retrieve

    Fixed

    Changed

    • Seperated Leaf Veins from Leaf Package
    • Renamed Session::getBody to Session::body

    Removed

    • Removed Leaf\View
    Source code(tar.gz)
    Source code(zip)
  • v2.0(Apr 22, 2020)

    Changelog

    v2.0 - official - 22nd April, 2020

    Added

    • Added Leaf Mail
    • Added Date::days_ago
    • Added Date::months_ago
    • Added Date::years_ago
    • Added Date::day
    • Added Date::month
    • Added Date::year
    • Added Auth::setSecretKey
    • Added Auth::getSecretKey
    • Added Auth::validate
    • Added Leaf JS Scripts [BETA]
    • Added Leaf Envryption Helper [BETA]
    • Added Leaf Password Helper [BETA]
    • Added secret key for token encryption in Leaf Authentication

    Fixed

    • Fixed Request::params
    • Fixed Request::getBody
    • Fixed Request Method Tests
    • Fixes to Auth::validateToken
    • Fixed bugs with Leaf DB packages
    • Fixed bugs on Auth::login and register
    • Fixed base64 security issues on Leaf Token [BETA]
    • Fixes on Form::isEmpty and isNull

    Changed

    • Renamed Request getBody to body
    • Switched all Date methods to snake_case
    • Switched FS methods to snake_case
    • Shortened Date method names (Find out more in the docs)
    • Made Leaf Authentication a helper (Leaf\Helper\Authentication)

    Removed

    • Removed Response::count
    • Removed Response::getIterator
    • Removed Response header offeset methods
    Source code(tar.gz)
    Source code(zip)
  • v2.0-beta(Mar 14, 2020)

    Changelog

    v2.0 - 14th March, 2020

    Added

    • Added DB->choose
    • Added DB->add
    • Added Auth->login
    • Added Auth->register
    • Added Session->unset
    • Added custom constructor to response
    • Added Response->messages(Http codes)
    • Added Response->setStatus/getStatus/status
    • Added Response->setHeader/getHeader/header
    • Added Response->setCookie/deleteCookie
    • Added Response->redirect
    • Added Request type checks
    • Added Request->cookies
    • Added Request->headers
    • Added Response Helpers
    • Added Leaf\Headers
    • Added Leaf\Cookies
    • Added ContentTypes Middleware
    • Added Flash messaging Middleware
    • Added PrettyExceptions Middleware
    • Added Logwriter and Log
    • Added Leaf View
    • Merged the Leaf Veins Templating engine and Leaf Core
    • Added Support for blade templating with Leaf Blade
    • Added support for more request types on Leaf::Request
    • Added Form::validateField
    • Provided security against XSS
    • Added Form::submit

    Fixed

    • Fixed SESSION->id
    • Fixed headers bug with Response->respondWithCode
    • Fixed headers bug with Response->throwErr

    Changed

    • Changed Leaf\Core namespace to Leaf
    • Changed Session->remove to Session->unset

    Removed

    • Removed Auth->basicLogin
    • Removed Auth->emailLogin
    • Removed Auth->basicRegister

    v1.5.0 - 11th December, 2019

    Added

    • Added FS->deleteFolder
    • Added FS->deleteFile
    • Added Form->validate๐Ÿ˜…
    • Added Form->validate and return errors to base controllers
    • Added Leaf\Core\Str: equivalent of Illuminate\Support\Str with added methods
    • Added Leaf Mysqli๐Ÿค”
    • Added Leaf PDO๐Ÿค”
    • Added Leaf\Core\Auth: simple login and signup

    Fixed

    • Fixed FS->deleteFile
    • Fixed FS->listDir
    • Fixed Leaf DB
    • Fixed init bug with session

    Changed

    • Renamed Veins->renderTemplate to render
    • Rename veins->assign to set()
    • Renamed mkdir to createFolder
    • Renamed mkdirInBase to createFolderInBase
    • Renamed renameDir to renameFolder
    • Changed vein file extension from .vein to .vein.php
    • Split Leaf\Config\Db between Leaf\Core\Db\Mysqli and Leaf\Core\Db\PDO
    • Changed renderHtml to renderPage
    • Changed all getParams to get

    Removed

    Nothing was removed

    v1.4.2 - 13th November, 2019

    Added

    • Added FileSystem module
    • Added mysqliQuery method to leaf\config\db
    • Added a bunch of handy session methods
    • Added leaf token
    • Added leaf form

    Fixed

    • Fixed a few problems with leaf\config\db;
    • Fixed tiny bug with response->throwErr

    Changed

    • Changed leaf\config\db: connection variables and connection type are set on db init. $db = new db($host, $user, $password, $dbname, "PDO")
    • Renamed renderHtmlPage to renderHtml

    Removed

    • Leaf\Config\DB has been depricated for now

    v1.4.1 - 1st November, 2019

    Added

    • Added base Leaf Controller Leaf\Core\Controller
    • Added base controller for APIs: Leaf\Core\ApiController
    • Added base Leaf Model Leaf\Core\Model
    • Added support for full MVC app
    • Added Leaf Veins in default Leaf package
    • Added Error Handling for development and production
    • Added a base database layer connected with custom environment variables

    Fixed

    • Fixed bug with Response::renderHtmlPage()
    • Fixed the HTTP code rendering in the browser from Response::respondWithCode

    Changed

    • Changed Validation to Form

    Removed

    • Removed Leaf Exceptions
    • Removed Middleware interfaces
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0-alpha(Dec 11, 2019)

    v1.5.0 - 11th December, 2019

    Added

    • Added FS->deleteFolder
    • Added FS->deleteFile
    • Added Form->validate๐Ÿ˜…
    • Added Form->validate and return errors to base controllers
    • Added Leaf\Core\Str: equivalent of Illuminate\Support\Str with added methods
    • Added Leaf Mysqli๐Ÿค”
    • Added Leaf PDO๐Ÿค”
    • Added Leaf\Core\Auth: simple login and signup

    Fixed

    • Fixed FS->deleteFile
    • Fixed FS->listDir
    • Fixed Leaf DB
    • Fixed init bug with session

    Changed

    • Renamed Veins->renderTemplate to render
    • Rename veins->assign to set()
    • Renamed mkdir to createFolder
    • Renamed mkdirInBase to createFolderInBase
    • Renamed renameDir to renameFolder
    • Changed vein file extension from .vein to .vein.php
    • Split Leaf\Config\Db between Leaf\Core\Db\Mysqli and Leaf\Core\Db\PDO
    • Changed renderHtml to renderPage
    • Changed all getParams to get

    Removed

    Nothing was removed

    Source code(tar.gz)
    Source code(zip)
  • v1.4.2(Nov 13, 2019)

    Changelog

    v1.4.1 - 13th November, 2019

    Added

    • Added FileSystem module
    • Added mysqliQuery method to leaf\config\db
    • Added a bunch of handy session methods
    • Added leaf token
    • Added leaf form

    Fixed

    • Fixed a few problems with leaf\config\db;
    • Fixed tiny bug with response->throwErr

    Changed

    • Changed leaf\config\db: connection variables and connection type are set on db init. $db = new db($host, $user, $password, $dbname, "PDO")
    • Renamed renderHtmlPage to renderHtml

    Removed

    • Leaf\Config\DB has been depricated for now
    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Nov 2, 2019)

    Changelog

    v1.4 - 1st November, 2019

    Added

    • Added base Leaf Controller Leaf\Core\Controller
    • Added base controller for APIs: Leaf\Core\ApiController
    • Added base Leaf Model Leaf\Core\Model
    • Added support for full MVC app
    • Added Leaf Veins in default Leaf package
    • Added Error Handling for development and production
    • Added a base database layer connected with custom environment variables
    • Added a bunch of methods for Form Validation
    • Added simple Token object for creating and validating tokens without JWT. These can be used in test projects but are not recommended for use in actual projects

    Fixed

    • Fixed bug with Response::renderHtmlPage()
    • Fixed the HTTP code rendering in the browser from Response::respondWithCode

    Changed

    • Changed Validation to Form

    Removed

    • Removed Leaf Exceptions
    • Removed Middleware interfaces
    Source code(tar.gz)
    Source code(zip)
Owner
Leaf Framework
Create clean, simple but powerful web applications and APIs quickly.
Leaf Framework
Simple PHP framework that helps you quickly understand and write simple APIs.

Lightweight-PHP-Framework-For-APIs. Simple PHP framework that helps you quickly understand and write simple APIs. Installation Use the package manager

Youssef Hajjari 24 Jul 22, 2022
Simple PHP framework that helps you quickly understand and write simple APIs.

Lightweight PHP Framework For Web and APIs PHP framework that helps you write quickly simple but powerful web apps and APIs Installation Use the packa

Youssef Hajjari 24 Jul 22, 2022
PhpBoot is an easy and powerful PHP framework for building RESTful/Microservices APIs.

?? tiny & fast PHP framework for building Microservices/RESTful APIs, with useful features: IOC, Hook, ORM, RPC, Swagger, Annotation, Parameters binding, Validation, etc.

tknet 656 Jan 4, 2023
A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast! Condensed in a single ~65KB file

Bong Cosca 2.6k Dec 30, 2022
Low-code Framework for Web Apps in PHP

Agile UI - User Interface framework for Agile Toolkit Agile Toolkit is a Low Code framework written in PHP. Agile UI implement server side rendering e

Agile Toolkit 404 Jan 8, 2023
A magic PHP framework. Build reactive web apps without writing HTML, CSS, or JavaScript! Powered by Tailwind, Alpine, Laravel, & Livewire.

Malzahar A magic PHP framework. Build reactive web apps without writing HTML, CSS, or JavaScript! Powered by Tailwind, Alpine, Laravel, & Livewire. Re

null 26 Nov 17, 2022
Gracili is a PHP Application Template to quickly create a new Project

Gracili What is Gracili? Gracili is a PHP Application Template to quickly create a new Project. Using this template can save you a lot of time. With t

Bjรถrn Pfoster 1 May 12, 2021
Sunhill Framework is a simple, fast, and powerful PHP App Development Framework

Sunhill Framework is a simple, fast, and powerful PHP App Development Framework that enables you to develop more modern applications by using MVC (Model - View - Controller) pattern.

Mehmet Selcuk Batal 3 Dec 29, 2022
TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs.

TrailLamp Introduction TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs. Installatio

Etorojah Okon 14 Jun 10, 2022
Bugsnag notifier for the Symfony PHP framework. Monitor and report errors in your Symfony apps.

Bugsnag exception reporter for Symfony The Bugsnag Notifier for Symfony gives you instant notification of errors and exceptions in your Symfony PHP ap

Bugsnag 43 Nov 22, 2022
This component may look complex, weird and full of hacks but it is a game changer for how we run PHP applications.

PHP Runtimes In early 2021, Symfony created a "Runtime component". This component may look complex, weird and full of hacks but it is a game changer f

Runtime 321 Dec 25, 2022
a framework for WebDevelop based on the mvc structure. The name of this project for Fun because everyone can use it. Completely simple and powerful structure for all your projects

A_A (-.-) โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„ |-| โ–ˆโ–„โ”€โ–„โ–„โ”€โ–ˆโ–„โ”€โ–ˆโ–ˆโ”€โ–„โ–ˆโ”€โ–„โ–„โ–„โ–„โ–ˆโ”€โ–„โ–„โ–„โ–„โ–ˆโ–„โ”€โ–ˆโ”€โ–„โ–ˆโ”€โ–„โ–„โ–„โ”€โ–ˆโ–ˆโ–€โ–„โ”€โ–ˆโ–ˆโ”€โ–„

MasihGhaznavi 7 Jun 29, 2022
REST APIs using Slim framework. Implemented all CRUD operations on the MySql database

PHP REST API using slim framework and CRUD operations ?? Hi there, this is a simple REST API built using the Slim framework. And this is for the folks

Hanoak 2 Jun 1, 2022
Framework X โ€“ the simple and fast micro framework for building reactive web applications that run anywhere.

Framework X Framework X โ€“ the simple and fast micro framework for building reactive web applications that run anywhere. Quickstart Documentation Tests

Christian Lรผck 620 Jan 7, 2023
A tiny, yet powerful, PHP micro-framework.

Equip Framework A tiny and powerful PHP micro-framework created and maintained by the engineering team at When I Work. Attempts to be PSR-1, PSR-2, PS

Equip 118 Jun 24, 2022
PHP Kafka client is used in PHP-FPM and Swoole. PHP Kafka client supports 50 APIs, which might be one that supports the most message types ever.

longlang/phpkafka Introduction English | ็ฎ€ไฝ“ไธญๆ–‡ PHP Kafka client is used in PHP-FPM and Swoole. The communication protocol is based on the JSON file in

Swoole Project 235 Dec 31, 2022
FlyCubePHP is an MVC Web Framework developed in PHP and repeating the ideology and principles of building WEB applications, embedded in Ruby on Rails.

FlyCubePHP FlyCubePHP is an MVC Web Framework developed in PHP and repeating the ideology and principles of building WEB applications, embedded in Rub

Anton 1 Dec 21, 2021
Multi-process coroutine edition Swoole spider !! Learn about Swoole's network programming and the use of its related APIs

swoole_spider php bin/spider // Just do it !! Cache use Swoole\Table; use App\Table\Cache; $table = new Table(1<<20); // capacity size $table->column

null 3 Apr 22, 2021