{"id":15938111,"url":"https://github.com/pluveto/cirno","last_synced_at":"2025-04-03T20:14:34.511Z","repository":{"id":109018474,"uuid":"235551520","full_name":"pluveto/cirno","owner":"pluveto","description":"Cirno is a light-weight php RESTful api framework","archived":false,"fork":false,"pushed_at":"2020-01-22T14:05:23.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T08:18:48.062Z","etag":null,"topics":["framwork","php","restful-api"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pluveto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-01-22T10:39:58.000Z","updated_at":"2022-04-02T10:14:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"eba2ab70-8f03-47a9-94db-a013d2e194dd","html_url":"https://github.com/pluveto/cirno","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pluveto%2Fcirno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pluveto%2Fcirno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pluveto%2Fcirno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pluveto%2Fcirno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pluveto","download_url":"https://codeload.github.com/pluveto/cirno/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247070928,"owners_count":20878586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["framwork","php","restful-api"],"created_at":"2024-10-07T05:21:12.689Z","updated_at":"2025-04-03T20:14:34.486Z","avatar_url":"https://github.com/pluveto.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://i.ibb.co/mD1SYh0/200px.png\" align=\"left\"\u003e\u003c/img\u003e\n\n\n# Cirno\n\n\n\nCirno-php is a light-weight php api framework for rapid development, based on Flight and Medoo, with apiDoc support.\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Features\n\nCirno-php helps create api with many **AUTOMATICAL** operations, which saves your massive time. \n\n1. Auto generate **http methods, routes** into files.\n2. Auto **parameters** basic filte.\n3. Auto **user permissions**  filte\n\nLet's take an example:\n\nCreate a file `src/Api/Calculator.php`\n\n```php\n\u003c?php\nnamespace App\\Api;\nclass Calculator\n{\n     /**\n     * @api {get} /calc/sqrt Calculate sqrt(num)\n     * @apiName sqrt\n     * @apiGroup Calculator\n     * @apiVersion 0.2\n     * @apiPermission none\n     * @apiParam {integer{0-200}} num The number to be calculated.\n     * @apiSuccess {integer} result The result of calculation.\n     * @apiSuccessExample\n     *  {\n     *  \"result\": 225\n     *  }\n     */\n    public function mySqrt()\n    {\n        $num = \\App::$api-\u003erequest()-\u003equery-\u003enum;\n        \\App::$api-\u003ejson([\n            \"result\" =\u003e $num * $num\n        ]);\n    }\n}\n```\n\nAnd execute:\n\n```shell\n$ php generator.php run\n```\n\nYou can see some files generated:\n\n```php\n//file: src/common/route.php\n\u003c?php\n$apiWelcome = new \\App\\Api\\Welcome();\nFlight::route('GET /', array($apiWelcome, 'index'));\n```\n\n```php\n//file: src/common/rule.php\nreturn [    \n    '/calc/sqrt' =\u003e [\n        'param' =\u003e [\n            'num' =\u003e [\n                'type' =\u003e 'integereger',\n                'min' =\u003e 0,\n                'max' =\u003e 200,\n                'required' =\u003e true,\n            ],\n        ],\n    ],\n];\n```\n\n```php\n//file: src/common/permission.php\n\u003c?php\nreturn[\n    '/calc/sqrt'=\u003e'none',\n];\n```\n\nAnd then we go to `http://127.0.0.1:8080/calc/sqrt?num=10`\n\nWe got:\n\n```json\n{\n  \"result\": 100\n}\n```\n\nWhat if `http://127.0.0.1:8080/calc/sqrt?num=1000`?\n\n```json\n{\n  \"message\": \"Parameter `num` is expected to be less than 200. \"\n}\n```\n\nAnd what if `http://127.0.0.1:8080/calc/sqrt?ss=1000`?\n\n```json\n{\n  \"message\": \"Mising required parameter.\"\n}\n```\n\nAnd `http://127.0.0.1:8080/calc/sqrt?num=`?\n\n```json\n{\n  \"message\": \"Parameter `num` is given but it has empty value.\"\n}\n```\n\n\n\nAs you can see, what you need to do is just write API code. API comments will be parsed.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpluveto%2Fcirno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpluveto%2Fcirno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpluveto%2Fcirno/lists"}