{"id":41659260,"url":"https://github.com/aminrafiei/php-framework","last_synced_at":"2026-01-24T16:57:47.110Z","repository":{"id":331852178,"uuid":"160871601","full_name":"aminrafiei/php-framework","owner":"aminrafiei","description":"A lightweight PHP micro-framework","archived":false,"fork":false,"pushed_at":"2024-11-06T20:37:08.000Z","size":196,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-11T15:39:03.515Z","etag":null,"topics":["framework","php","php-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aminrafiei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-12-07T20:21:00.000Z","updated_at":"2020-02-04T06:04:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aminrafiei/php-framework","commit_stats":null,"previous_names":["aminrafiei/php-framework"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/aminrafiei/php-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminrafiei%2Fphp-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminrafiei%2Fphp-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminrafiei%2Fphp-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminrafiei%2Fphp-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aminrafiei","download_url":"https://codeload.github.com/aminrafiei/php-framework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminrafiei%2Fphp-framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28732210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","php","php-framework"],"created_at":"2026-01-24T16:57:47.049Z","updated_at":"2026-01-24T16:57:47.105Z","avatar_url":"https://github.com/aminrafiei.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\nPHP micro-framework\n\u003c/h1\u003e\n\n---------------------\n\n## Overview:\n\n- #### This is a a lightweight PHP micro-framework that has syntax like \u003cstrong\u003eLaravel framework\u003c/strong\u003e\n \n----------------------\n\n## :bulb: Documentation \u0026 Sample Code:\n\n\n### Sample:How to add a route?\n\nYou can add your route in routes folder in routes.php.\n\u003cbr\u003e\nYou can use GET, POST, DELETE methods for your routes.\n```php\nuse Core\\Router;\n\nRouter::METHOD({path}, {clouser} | {controller-name@method-name}) \n```\nSample route :\n```php\nuse Core\\Router;\n\nRouter::make()-\u003eget('hellowrold',function (){\n    return \"Hello World!\";\n});\nRouter::make()-\u003epost('home','PagesController@home');\n```\n\n### Sample:how to use Dependency Injection?\n\nWhen you call Controller that has dependency, framework automatically inject a instance of that Class/Interface .\n\u003cbr\u003e\n\u003cstrong\u003eif you inject interface you must specify which implementation of that interface should bind in bootstarp.php!\u003c/strong\u003e\n```php\n/**\n * Class bootstrap\n */\nclass bootstrap\n{\n    /**\n     * @var array\n     */\n    public static $binds = [];\n\n    /**\n     * @var array\n     */\n    public static $registers = [\n        SomeInterface::class =\u003e SomeService::class,\n    ];\n    \n    ...\n}\n```\n\nExample:\n```php\nclass AuthController extends BaseController\n{\n    protected $user;\n\n    public function __construct(User $user, SomeInterface $someInterface)\n    {\n        $this-\u003euser = $user;\n    }\n    ...\n```\n\n---------------------\n\n### Sample:how to use Middlewares?\n\nYou can use middleware for all routes or specific Controller by register your middleware in ```$middlewares``` and for all routes ```$routeMiddlewares```\n\u003cbr\u003e\n\u003ci\u003eyou can register in bootstrap.php file\u003c/i\u003e\n```php\n/**\n * Class bootstrap\n */\nclass bootstrap\n{\n    ...\n    \n    /**\n     * apply this middlewares for all routes\n     *\n     * @var array\n     */\n    public static $routeMiddlewares = [\n        'trim',\n    ];\n\n    /**\n     * register middlewares\n     *\n     * @var array\n     */\n    public static $middlewares = [\n        'trim' =\u003e \\Core\\Kernel\\Middleware\\Rules\\Trim::class,\n        'auth' =\u003e \\Core\\Kernel\\Middleware\\Rules\\Auth::class,\n    ];\n}\n```\n\nExample:\n```php\nclass PagesController extends BaseController\n{\n    //without params\n    static $middleware = 'auth';\n\n    //also you can send params to your middleware\n    static $middleware = ['role' =\u003e 'admin'];\n\n    ...\n```\n\n```php\nclass Middleware implements MiddlewareContract\n{\n    /**\n     * you can handle validation by return boolean!\n     * \"true\" for accept and \"false\" for failed\n     *\n     * @param array|null $params\n     * @return bool\n     */\n    public static function handle(array $params = null): bool\n    {\n        ...\n        \n        return true;\n    }\n\n    /**\n     * Error message if middleware validation failed\n     *\n     * @return string\n     */\n    public static function message(): string\n    {\n        return ...;\n    }\n}\n```\n\n---------------------\n\n### Sample:how to use ORM?\nThe framework has simple orm that you can CRUD and use \"Where\" clause for add condition in your query.\n```php\n$this-\u003euser-\u003ewhere('name', 'Amin', 'LIKE')\n           -\u003eandWhere('age', 20, '=')\n            \u003eget();\n```\n\n---------------------\n\n### Sample:how to use validation?\nThe framework has simple validation that you can validate \"Email, Number, Required\"\n\u003cbr\u003e\nand it returns true/false\n```php\n\n$request = request()-\u003eget();\n\n$validation = validation()-\u003evalidate($request, [\n            'name'     =\u003e ['required'],\n            'username' =\u003e ['required', 'email'],\n            'password' =\u003e ['required'],\n        ]);\n```\n---------------------\n\n### Sample:how to use cache?\nThe framework has cache that implement Redis as default\n\u003cbr\u003e\n\u003ci\u003eyou can change it in bootstrap.php file\u003c/i\u003e\n\n```php\n  \n  cache()-\u003eremember('someThing',function (){\n              return $this-\u003euser-\u003efirst();\n  },999)\n  \n```\n---------------------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminrafiei%2Fphp-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faminrafiei%2Fphp-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminrafiei%2Fphp-framework/lists"}