{"id":21090664,"url":"https://github.com/ycrao/tinyme","last_synced_at":"2026-01-17T16:28:44.838Z","repository":{"id":57086431,"uuid":"64918575","full_name":"ycrao/tinyme","owner":"ycrao","description":"A tiny php framework based on flight and medoo with restful api service","archived":false,"fork":false,"pushed_at":"2026-01-16T11:00:12.000Z","size":1210,"stargazers_count":41,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-16T13:19:00.964Z","etag":null,"topics":["api","demo","flight","medoo","php","rest","restful-api","tiny-php-framework","tinyme"],"latest_commit_sha":null,"homepage":"https://raoyc.com/tinyme/index.html","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/ycrao.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}},"created_at":"2016-08-04T08:46:05.000Z","updated_at":"2026-01-16T03:38:45.000Z","dependencies_parsed_at":"2022-08-24T22:50:49.140Z","dependency_job_id":null,"html_url":"https://github.com/ycrao/tinyme","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ycrao/tinyme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycrao%2Ftinyme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycrao%2Ftinyme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycrao%2Ftinyme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycrao%2Ftinyme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ycrao","download_url":"https://codeload.github.com/ycrao/tinyme/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycrao%2Ftinyme/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"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":["api","demo","flight","medoo","php","rest","restful-api","tiny-php-framework","tinyme"],"created_at":"2024-11-19T21:39:10.904Z","updated_at":"2026-01-17T16:28:44.829Z","avatar_url":"https://github.com/ycrao.png","language":"PHP","readme":"# TinyMe V2\n\n[![Latest Stable Version](https://poser.pugx.org/ycrao/tinyme/v/stable.svg?format=flat-square)](https://packagist.org/packages/ycrao/tinyme)\n[![Latest Unstable Version](https://poser.pugx.org/ycrao/tinyme/v/unstable.svg?format=flat-square)](https://packagist.org/packages/ycrao/tinyme)\n[![License](https://poser.pugx.org/ycrao/tinyme/license?format=flat-square)](https://packagist.org/packages/ycrao/tinyme)\n[![Total Downloads](https://poser.pugx.org/ycrao/tinyme/downloads?format=flat-square)](https://packagist.org/packages/ycrao/tinyme)\n\n\u003e   A tiny PHP framework based on FlightPHP and Medoo.\n\n[IntroductionPage](https://raoyc.com/tinyme/index.html) | [简体中文读我](README_zh-CN.md) | [Old Version TinyMe](https://github.com/ycrao/tinyme/tree/v1)\n\n## Installation\n\nJust like `Laravel` installation, set `public` directory as server root path in `vhost.conf` and using `composer` to install or update packages and so on. You can do these in your terminal like below:\n\n```bash\n# using git\ngit clone https://github.com/ycrao/tinyme.git tinyme\n# or using composer, but skip `composer install` command below\ncomposer create-project --prefer-dist ycrao/tinyme tinyme\ncd tinyme\ncp .env.example .env\nvim .env\ncomposer install\ncd app\nchmod -R 755 storage\nphp -S 127.0.0.1:9999 -t public\n# or using composer\ncomposer start\n```\nYou can view this project page by typing `http://127.0.0.1:9999` url in your browser.\n\n## API Service\n\nPlease import `sql\\tinyme.sql` to your local MySQL database, then modify `.env` file configuration. \n\n### Route\n\n| Method   | Route or URI    | Note                                    |\n| :------- | :-------------- | :-------------------------------------- |\n| `post`   | `/api/login`    | Get access-token by logining account.   |\n| `get`    | `/api/pages`    | Get current user pages with pagination. |\n| `post`   | `/api/page`     | Create a new page.                      |\n| `get`    | `/api/page/@id` | Get page by specified id.               |\n| `put`    | `/api/page/@id` | Update page by specified id.            |\n| `delete` | `/api/page/@id` | Delete page by specified id.            |\n\n### API error code\n\n| Code               | Note                              |\n| :----------------- | :-------------------------------- |\n| 500                | fail or error.                    |\n| 401 (Unauthorized) | access token already expired.     |\n| 403 (Forbidden)    | illegal or incorrect credentials. |\n| 404 (Not Found)    | api or route not existed.         |\n| 200 (OK)           | success.                          |\n\n### post `api/login`\n\n\u003e   Using email and password to login and get access token. Please recall login api when token is expired, do not call this api frequently when old token(s) not expired.\n\n#### Request Example\n\n```bash\ncurl --request POST \\\n  --url http://127.0.0.1:9999/api/login \\\n  --header 'Content-Type: application/json' \\\n  --data '{\n  \"email\": \"foo@example.com\",\n  \"password\": \"123456\"\n}'\n```\n\n#### Response Example\n\nUsing `200` as `code` when success.\n\n```json\n{\n  \"code\": 200,\n  \"msg\": \"ok\",\n  \"data\": {\n    \"uid\": 1,\n    \"token\": \"hdtvEsu3FNEsyR069XNeTCzKSUFyWzAgSe7GcCjy\",\n    \"expire_at\": 1768590265\n  }\n}\n```\n\nUsing non-2xx (`403` 、`500` etc.) digital when fail or error.\n\n```json\n{\n  \"code\": 403,\n  \"msg\": \"illegal or incorrect credentials\",\n  \"data\": null\n}\n```\n\n### get `api/pages`\n\n\u003e   Get current user pages with pagination.\n\n#### Request Example\n\n```\ncurl --request GET \\\n  --url http://127.0.0.1:9999/api/pages?page=1\u0026per_page=2 \\\n  --header 'Authorization: Bearer hdtvEsu3FNEsyR069XNeTCzKSUFyWzAgSe7GcCjy'\n```\n\n#### Response Example\n\n```json\n{\n  \"code\": 200,\n  \"msg\": \"ok\",\n  \"data\": {\n    \"total\": 1,\n    \"per_page\": 10,\n    \"current_page\": 1,\n    \"next_page_url\": null,\n    \"prev_page_url\": null,\n    \"from\": 1,\n    \"to\": 1,\n    \"data\": [\n      {\n        \"id\": 1,\n        \"content\": \"# Hello world\\n\\nThis is a demo page.\",\n        \"created_at\": \"2017-11-09 13:54:39\",\n        \"updated_at\": \"2017-11-09 13:54:39\"\n      }\n    ]\n  }\n}\n```\n\n### post `api/page`\n\n\u003e   Create a new page.\n\n#### Request Example\n\n```bash\ncurl --request POST \\\n  --url http://127.0.0.1:9999/api/page \\\n  --header 'Authorization: Bearer hdtvEsu3FNEsyR069XNeTCzKSUFyWzAgSe7GcCjy' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"content\":\"# TinyMe \\n\\n\u003e  A tiny PHP framework based on FlightPHP and Medoo.\"}'\n```\n\n#### Response Example\n\n```json\n{\n  \"code\": 201,\n  \"msg\": \"created!\",\n  \"data\": {\n    \"result\": \"create success!\",\n    \"view_url\": \"/api/page/2\"\n  }\n}\n```\n\n### get `api/page/@id`\n\n\u003e   Get page by specified id.\n\n#### Request Example\n\n```bash\ncurl --request GET \\\n  --url http://127.0.0.1:9999/api/page/2 \\\n  --header 'Authorization: Bearer hdtvEsu3FNEsyR069XNeTCzKSUFyWzAgSe7GcCjy'\n```\n\n#### Response Example\n\n```json\n{\n  \"code\": 200,\n  \"msg\": \"ok\",\n  \"data\": {\n    \"id\": 2,\n    \"uid\": 1,\n    \"content\": \"# TinyMe \\n\\n\u003e  A tiny PHP framework based on FlightPHP and Medoo.\",\n    \"created_at\": \"2026-01-17 01:16:47\",\n    \"updated_at\": \"2026-01-17 01:16:47\"\n  }\n}\n```\n\n### put `api/page/@id`\n\n\u003e   Update page by specified id.\n\n#### Request Example\n\n```bash\ncurl --request PUT \\\n  --url http://127.0.0.1:9999/api/page/2 \\\n  --header 'Authorization: Bearer hdtvEsu3FNEsyR069XNeTCzKSUFyWzAgSe7GcCjy' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\n  \"content\": \"# Flight \\n\\n\u003e  Flight is a fast, simple, extensible framework for PHP. Flight enables you to quickly and easily build RESTful web applications.\"\n}'\n```\n\n#### Response Example\n\n```json\n{\n  \"code\": 200,\n  \"msg\": \"ok\",\n  \"data\": {\n    \"result\": \"update success!\"\n  }\n}\n```\n\n### delete `/api/page/@id`\n\n\u003e   Delete page by specified id.\n\n#### Request Example\n\n```bash\ncurl --request DELETE \\\n  --url http://127.0.0.1:9999/api/page/2 \\\n  --header 'Authorization: Bearer hdtvEsu3FNEsyR069XNeTCzKSUFyWzAgSe7GcCjy' \\\n  --header 'Content-Type: application/json'\n```\n\n#### Response Example\n\n```json\n{\n  \"code\": 200,\n  \"msg\": \"ok\",\n  \"data\": {\n    \"result\": \"delete success!\"\n  }\n}\n```\n\n## Documentation\n\n### Kernel\n\nbased on `flightphp/core` [repo](https://github.com/flightphp/core) , official website : https://flightphp.com/  .\n\n### Cache\n\n```php\nuse flight\\Cache;\n\n$app = Flight::app();\n// Register cache\n$app-\u003eregister('cache', Cache::class, [__DIR__ . '/../storage/cache']);\n\n$app-\u003ecache()-\u003eset('hello', 'world', 60 * 60);\n$world = $app-\u003ecache()-\u003eget('hello');\n```\n\nbased on `flightphp/cache` [repo](https://github.com/flightphp/cache) , official website : https://docs.flightphp.com/en/v3/awesome-plugins/php-file-cache .\n\n### Log\n\n```php\nuse Monolog\\Logger;\nuse Monolog\\Level;\nuse Monolog\\Handler\\StreamHandler;\n\n$app = Flight::app();\n// Register logger\n$app-\u003eregister('logger', Logger::class, ['tinyme'], function($logger) {\n    $logPath = __DIR__ . '/../storage/logs/app.log';\n    $logger-\u003epushHandler(new StreamHandler($logPath, Level::Debug));\n});\n```\n\nbased on `monolog/monolog` [repo](https://github.com/Seldaek/monolog) , official website : https://seldaek.github.io/monolog/ .\n\n\n### Database and Model\n\n```php\nuse Medoo\\Medoo;\nuse app\\utils\\Helper;\n\n$app = Flight::app();\n\n// Register database\n$app-\u003eregister('db', Medoo::class, [\n    [\n        'type' =\u003e 'mysql',\n        'host' =\u003e Helper::env('DB_HOST', 'localhost'),\n        'port' =\u003e Helper::env('DB_PROT', 3306),\n        'database' =\u003e Helper::env('DB_DATABASE', 'tinyme'),\n        'username' =\u003e Helper::env('DB_USERNAME', 'root'),\n        'password' =\u003e Helper::env('DB_PASSWORD', 'root'),\n        'charset' =\u003e 'utf8mb4',\n        'collation' =\u003e 'utf8mb4_unicode_ci',\n    ]\n]);\n\n$page = $app-\u003edb()-\u003eget('tm_page', '*', [\n    'id' =\u003e 1\n]);\n```\n\nbased on `catfan/medoo` [repo](https://github.com/catfan/medoo) , official website : https://medoo.in/doc .\n\n## Reference\n\n- [flightphp/skeleton](https://github.com/flightphp/skeleton)\n\n## License\n\nThe TinyMe framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycrao%2Ftinyme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fycrao%2Ftinyme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycrao%2Ftinyme/lists"}