Lemon is php micro framework built for simple applications.

Overview

Lemon

Lemon is php micro framework built for simple applications.
Latest version: 2.1.1
Documentation: https://tenmajkl.github.io/docs.html

Installation

Installation is provided via composer:
composer create-project lemon_framework/lemon:dev-master project-name

If you want to build starting app type php lemonade build type:project

Minimal app

Here is code of simple app build only in index.php

/", function($var) { echo $var; }); Route::any("/", function() { echo "hi"; }); Route::handler(404, function() { echo "404"; }); Route::execute(); ?> ">

require "/lemon/framework.php";


Route::get("/relative//", function($var)
    {
        echo $var;
    });

Route::any("/", function()
    {
        echo "hi";
    });

Route::handler(404, function()
    {
        echo "404";
    });

Route::execute();

?>
Comments
  • [Router] dynamic prefix

    [Router] dynamic prefix

    I'm working on project, where would be handy to have dymanic prefix in Route::controller. Obviously it would be on every collection, but on controllers it would save me 1 line of code.

    Route::controller("forgotten-password/{token}", ForgotenPassword::class);
    

    instead of

    Route::get("forgotten-password/{token}", [ForgotenPassword::class, 'get']);
    Route::post("forgotten-password/{token}", [ForgotenPassword::class, 'post']);
    
    opened by TENMAJKL 11
  • Config

    Config

    There will be config for everything. But everything will be pre-seted. To start using more files type Config::init() and then use separate config classes which will use basics from Config::init() like directory. There will be also ability to use config.json which will be loaded using Config::init(). All this will get pre-seted using App.php and also with loader config?

    v3 
    opened by TENMAJKL 4
  • [Container] Fibers

    [Container] Fibers

    This PR uses fibers when calling function via Container::call(). Instead of regular calling it creates fiber, starts it and returns either first suspension value or return value. Meaning that in e.g routing (which uses this method) if you do

    Route::get('/', function() {
        Fiber::suspend(template('home'));
        return 'foo';
    });
    

    It would return template home, instead of 'foo'.

    Curently there is no actual usage, but its first step before resolving #112 which would use this instead of Exceptions as it makes more sense. But maybe its bad idea who knows

    opened by TENMAJKL 1
  • Juice tags escaping

    Juice tags escaping

    This PR adds escaping of juice tags. This means that when you put \ before any juice tag ({}, {{}}, {!!}, {##}) it will be rendered without \ as it is. This allows us to write css in juice.

    .foo \{
       color: red
    }
    

    It also fixes writing @ in blade syntax.

    opened by TENMAJKL 1
  • Running lemonade server with space in path not possible

    Running lemonade server with space in path not possible

    If you on Windows try to run php lemonade serve command in Lemon project directory which is located in path containing space, you'll get a "directory not found" error for first part of the path split at the space character. It should be fixed by adding quotation marks around the path and taking care to pass whole path as a argument to php server command.

    opened by CoolFido 1
  • Implement RouteCore::view() method

    Implement RouteCore::view() method

    RouteCore::view() method allows you to return view directly from GET route definition method. It also allows you to use only one argument, when URI is matching path to view (with / changed to .).

    opened by CoolFido 1
  • __toString() has been deprecated

    __toString() has been deprecated

    https://github.com/Lemon-Framework/Lemon/blob/fc610730730ad42af95e775359575a86c7234e9a/src/Http/Routing/Helpers.php#L24

    This function has been DEPRECATED as of PHP 7.1.0. Relying on this function is highly discouraged.

    https://www.php.net/manual/en/reflectiontype.tostring.php

    opened by ordago 1
  • [Http] CookieJar

    [Http] CookieJar

    This PR adds CookieJar. CookieJar is class which connects cookies from request and response. Currently if you wanted to read and write cookie, you would have to get the cookie from request and set it to response. Also, setting cookie required having the response which lead to problematic situations such as CSRF middleware.

    opened by TENMAJKL 0
  • [Router] adds AfterAction middlewares

    [Router] adds AfterAction middlewares

    This PR fixes middleware running. Currently middlewares were ran after router action and if some middleware returned response, the response was used instead of action response. This could actually lead to some problems, so now every middleware is ran before action by default. If there is middleware with \Lemon\Routing\Attributes\AfterAction attribute, it would be ran after action with injectable response prototype.

    So if we wanted middleware that would change header it would be like this:

    <?php
    
    use Lemon\Routing\Attributes\AfterAction;
    use Lemon\Http\Response;
    
    class SomeMiddleware
    {
        #[AfterAction]
        public function header(Response $prototype): Response
        {
            return $prototype->header('Content-Type', 'text/plain');
        }
    }
    
    opened by TENMAJKL 0
  • Adds Translating

    Adds Translating

    This PR adds new Translating component. This component allows building multi-language websites more easily. You simply define translation files like this:

    // translations/en.php
    return [
        'title' => 'Welcome to the Lemon Framework'
    ];
    
    // translations/cs.php
    return [
        'title' => 'Vitejte v citronove ramopraci'
    ];
    

    Locale can be changed via \Lemon\Translator::locate().

    And texts can be accessed via \Lemon\Translator::text() or { text } juice directive.

    It also adds \Lemon\Translating\Middlewares\TranslationLocalizer which can be used to automatically set locale from sesion.

    opened by TENMAJKL 0
  • Adds terminal handler

    Adds terminal handler

    This pull request adds reporter into terminal.

    Lemon Terminal Handler

    Features

    • Consultant-based hints
    • Code snippets of file where error happened with syntax highlighting
    • Simple trace with file and line

    Highlighter

    This PR also adds new Highlighter component 🎉

    This component allows you to render php code in html like highlight_string but is more customizable.

    opened by TENMAJKL 0
  • [Container] Custom injectable classes

    [Container] Custom injectable classes

    When container injects and finds class that is not in container and has some interface? it will try to create it by the interface (probably static) method

    opened by TENMAJKL 0
Releases(3.13.0)
  • 3.13.0(Jan 7, 2023)

    Adds

    • CookieJar in #118

    Fixes

    • Bug of not-showing reporter in errors before request was initialized

    This update has major security fix, so please update ASAP.

    Good night and have fun dudes 🍋

    Source code(tar.gz)
    Source code(zip)
  • 3.12.0(Jan 7, 2023)

    Fixed

    • Session destroying and expiration
    • Validator Exception
    • Middleware running in #117

    Changed

    • Running route actions as fibers in #113

    Also, this update is kinda important as it fix possibly fatal problem in #117 so updating is recommended.

    Good night and have fun dudes! 🍋

    Source code(tar.gz)
    Source code(zip)
  • 3.11.0(Jan 2, 2023)

    Added

    • Testing of template parameters in #107 and commits

    Fixed

    • Session type

    Until February, most updates will be probably fixes like this, so I can finish one project. Have fun dudes! 🍋

    Source code(tar.gz)
    Source code(zip)
  • 3.10.1(Dec 20, 2022)

  • 3.10.0(Nov 20, 2022)

  • 3.9.0(Nov 5, 2022)

  • 3.8.0(Oct 30, 2022)

  • 3.7.0(Oct 27, 2022)

  • 3.6.6(Oct 6, 2022)

  • 3.6.5(Oct 5, 2022)

  • 3.6.4(Oct 5, 2022)

  • 3.6.3(Oct 5, 2022)

  • 3.6.2(Oct 5, 2022)

  • 3.6.1(Oct 3, 2022)

  • 3.6.0(Oct 2, 2022)

  • 3.5.2(Sep 14, 2022)

  • 3.5.1(Sep 13, 2022)

  • 3.5.0(Sep 9, 2022)

    Added

    • Session testing
    • >>>= as alias to then in pipe (epic haskell moment)
    • legendary is_user_podvodnik function

    Changed

    • Response Zest to ResponseFactory
    • Session contract

    Have fun dudes

    Source code(tar.gz)
    Source code(zip)
  • 3.4.2(Aug 31, 2022)

    Fix

    • TestCase now creates application only once for each test in setUp, and is accessible by $this->application
    • Reporter now doesnt show project directory prefix in stacktrace
    Source code(tar.gz)
    Source code(zip)
  • 3.4.1(Aug 30, 2022)

    Fix

    • Escaping of link attributes in Juice. (Please if you use echo tags in your templates update and remove compiled templates)
    • Reporter warning reporting
    Source code(tar.gz)
    Source code(zip)
  • 3.4.0(Aug 22, 2022)

    Good afternoon! How you doing? I hope you are doing fine.

    Added

    • Contracts, this means that every service has its interface so testing is way better now
    • TestCase for phpunit which makes website testing possible.

    Have fun dudes! 🍋

    Source code(tar.gz)
    Source code(zip)
  • 3.3.0(Aug 18, 2022)

    Good evening!

    Added

    • response() helper which is equivalent to Response::resolve()
    • __toString method on Response
    • Response::cookies() which returns all cookies

    Removes

    • optional parts in dynamic routing
    • ClosureSerializer

    Changes

    • middlewares are now executed after route callback and they can access their response by injecting \Lemon\Http\Response

    Fixes

    • Container::call() now actually passes arguments by their name

    Most of these updates were because of Squeezer and we're not finished yet.

    Good night and have fun. 🍋

    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Aug 17, 2022)

  • 3.1.1(Aug 15, 2022)

  • 3.1.0(Aug 14, 2022)

    Added

    • better controller support (now you can do [Controller::class, 'method'], instead of [new Controler(), 'method'])
    • help command

    Changed

    • Lifecycle to Application
    • container services can be overwritten

    Fixed

    • csrf middleware (now supports all methods and not just POST/PUT)
    • template:clear description
    Source code(tar.gz)
    Source code(zip)
  • 3.0.2(Aug 13, 2022)

  • 3.0.1(Aug 4, 2022)

  • 3.0.0(Aug 3, 2022)

    This is Lemon 3.

    After more than year of work its here. Update that was meant to only add database and changed everything.

    Whats new? Well Everything.

    https://user-images.githubusercontent.com/61601336/182679585-bb73041f-ad60-4352-94cf-2c8d27761906.mp4

    Source code(tar.gz)
    Source code(zip)
  • 2.6.9(Jan 22, 2022)

  • 2.6.8(Jan 12, 2022)

    This update fixes lemonade serve for dirs with space and Route::controller request methods. It has also included Route::view

    Most of it is by @CoolFido

    Source code(tar.gz)
    Source code(zip)
Owner
Lemon
Lemon microframework repos
Lemon
[DEPRECATED -- Use Symfony instead] The PHP micro-framework based on the Symfony Components

Silex, a simple Web Framework WARNING: Silex is in maintenance mode only. Ends of life is set to June 2018. Read more on Symfony's blog. Silex is a PH

Silex 3.6k Dec 22, 2022
A resource-oriented micro PHP framework

Bullet Bullet is a resource-oriented micro PHP framework built around HTTP URIs. Bullet takes a unique functional-style approach to URL routing by par

Vance Lucas 415 Dec 27, 2022
Frankie - A frankenstein micro-framework for PHP

Frankie - A frankenstein micro-framework for PHP Features Frankie is a micro-framework focused on annotation. The goal is to use annotation in order t

null 19 Dec 10, 2020
ExEngine is an ultra lightweight micro-services framework for PHP 5.6+

ExEngine is an ultra lightweight micro-services framework for PHP 5.6+. Documentation Checkout the Wiki. Examples Click here to browse examples, also

linkfast.io 1 Nov 23, 2020
REST-like PHP micro-framework.

Phprest Description REST-like PHP micro-framework. It's based on the Proton (StackPhp compatible) micro-framework. Phprest gives you only the very bas

Phprest 312 Dec 30, 2022
Silly CLI micro-framework based on Symfony Console

currentMenu home Silly CLI micro-framework based on Symfony Console. Professional support for Silly is available via Tidelift Video introduction in fr

Matthieu Napoli 862 Dec 23, 2022
Blink is a micro web framework for building long-running and high performance services

Blink is a micro web framework for building long-running and high performance services, the design heavily inspired by Yii2 and Laravel. Blink aims to provide the most expressive and elegant API and try to make the experience of web development as pleasant as possible.

Jin Hu 837 Dec 18, 2022
StackSync is a simple, lightweight and native fullstack PHP mini-framework.

StackSync is a fullstack PHP mini framework, with an MVC structure, custom API system with a Middleware and JWT authentication, components based views, flexible routing, PSR4 autoloading. Essential files generation (migrations, seeders, controllers and models) and other operations can be executed through custom commands.

Khomsi Adam 3 Jul 24, 2022
PHP微服务框架即Micro Service Framework For PHP

Micro Service Framework For PHP PHP微服务框架即“Micro Service Framework For PHP”,是Camera360社区服务器端团队基于Swoole自主研发现代化的PHP协程服务框架,简称msf或者php-msf,是Swoole的工程级企业应用框

Camera360 1.8k Jan 5, 2023
VELOX - The fastest way to build simple websites using PHP!

VELOX The fastest way to build simple websites using PHP! Table of Contents Installation About VELOX Architecture Config Classes Functions Themes Chan

Marwan Al-Soltany 53 Sep 13, 2022
The Laravel Lumen Framework.

Lumen PHP Framework Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe d

The Laravel Framework 7.6k Jan 7, 2023
Slim Framework 4 Skeleton Application

Slim Framework 4 Skeleton Application Use this skeleton application to quickly setup and start working on a new Slim Framework 4 application. This app

Slim Framework 1.5k Dec 29, 2022
🐺 Lightweight and easy to use framework for building web apps.

Wolff Web development made just right. Wolff is a ridiculously small and lightweight PHP framework, intended for those who want to build web applicati

Alejandro 216 Dec 8, 2022
Larasymf - mini framework for medium sized projects based on laravel and symfony packages

Larasymf, PHP Framework Larasymf, as its says is a mini framework for medium sized projects based on laravel and symfony packages We have not yet writ

Claude Fassinou 6 Jul 3, 2022
⚡ Flat-files and plain-old PHP functions rockin'on as a set of general purpose high-level abstractions.

Siler is a set of general purpose high-level abstractions aiming an API for declarative programming in PHP. ?? Files and functions as first-class citi

Leo Cavalcante 1.1k Dec 30, 2022
A PHP client for (Spring Cloud) Netflix Eureka service registration and discovery.

PHP Netflix Eureka Client A PHP client for (Spring Cloud) Netflix Eureka service registration and discovery. Installation You can install this package

Hamid Mohayeji 72 Aug 21, 2022
Yet another PHP Microframework.

ρ Yet another PHP Microframework. The premise of this framework is to be backwards-compatible (PHP <= 5.6) with powerful utilities (Like caching and l

null 0 Apr 6, 2022
php 8 client for the lemon.markets api

lemon.markets php client This repository contains a php 8+ compatible client for the https://lemon.markets API. The documentation of the API can be fo

Daniel Freudenberger 4 Nov 17, 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
Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.

Slim Framework Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs. Installation It's recommended

Slim Framework 11.5k Jan 4, 2023