{"id":22852120,"url":"https://github.com/alicfeng/laravel-runtime","last_synced_at":"2025-09-04T02:36:30.111Z","repository":{"id":38428120,"uuid":"176969873","full_name":"alicfeng/laravel-runtime","owner":"alicfeng","description":"基于Laravel构建请求信息日志以及接口智能分析","archived":false,"fork":false,"pushed_at":"2019-06-12T17:26:36.000Z","size":74,"stargazers_count":9,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T09:17:28.877Z","etag":null,"topics":["analysis","api","laravel","runtime"],"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/alicfeng.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}},"created_at":"2019-03-21T15:09:13.000Z","updated_at":"2023-09-11T01:01:27.000Z","dependencies_parsed_at":"2022-08-18T08:21:04.858Z","dependency_job_id":null,"html_url":"https://github.com/alicfeng/laravel-runtime","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/alicfeng/laravel-runtime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicfeng%2Flaravel-runtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicfeng%2Flaravel-runtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicfeng%2Flaravel-runtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicfeng%2Flaravel-runtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alicfeng","download_url":"https://codeload.github.com/alicfeng/laravel-runtime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicfeng%2Flaravel-runtime/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273542643,"owners_count":25124202,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["analysis","api","laravel","runtime"],"created_at":"2024-12-13T06:07:14.683Z","updated_at":"2025-09-04T02:36:30.093Z","avatar_url":"https://github.com/alicfeng.png","language":"PHP","readme":"## \n\n\n\n\u003ch1 align=\"center\"\u003e\n    \u003ca href=\"https://github.com/alicfeng/laravel-runtime\"\u003e\n        Laravel Runtime\n    \u003c/a\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e \n    laravel-runtime features for Laravel Application\n    \u003cimg src=\"https://raw.githubusercontent.com/alicfeng/laravel-runtime/master/file/runtime.jpg\" /\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://packagist.org/packages/alicfeng/laravel-runtime\"\u003e\n    \t\u003cimg src=\"https://poser.pugx.org/alicfeng/laravel-runtime/v/stable.svg\" alt=\"Latest Stable Version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/alicfeng/laravel-runtime\"\u003e\n        \u003cimg src=\"https://poser.pugx.org/alicfeng/laravel-runtime/d/total.svg\" alt=\"Total Downloads\"\u003e\n    \u003c/a\u003e\n\t\u003ca href=\"https://packagist.org/packages/alicfeng/laravel-runtime\"\u003e\n    \t\u003cimg src=\"https://poser.pugx.org/alicfeng/laravel-runtime/license.svg\" alt=\"License\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\n\u003ca href=\"https://github.styleci.io/repos/127536154\"\u003e\n\u003c/h1\u003e\n\n#### 前言\n\n`laravel-runtime`此项目为`Laravel`中的插件\n\n无论在开发、测试还是生产环境中，我们皆比较注重请求的数据，一般的做法是将有价值的数据写入在日志当中，便于调试、问题排查等，在`Request`到达控制器前处理数据信息的写入，在此使用`Http`中间件拦截处理，即在请求在中间件中做**日志记载**。\n\n同时、在开发以及测试的时候，一个合格的开发者总是会关注其接口是否存在性能上的问题，比如接口请求的时间消耗多少等，此插件可以通过`CLI`模式在终端以表格的形式展示接口的基本状况，`web`端界面亦可以简约展示，如下图所示\n\n- `CLI终端`\n\n![runtime-cli](https://raw.githubusercontent.com/alicfeng/laravel-runtime/master/file/runtime.jpg)\n\n- `WEB端`\n\n![runtime-web](https://raw.githubusercontent.com/alicfeng/laravel-runtime/master/file/web.png)\n\n\n\n#### 功能\n\n- 接口请求的核心数据日志记载\n- 接口请求记录分析\n\n\n\n#### 环境要求\n\n- `PHP`\u003e=7.0\n- `composer`\n- `laravel`\n\n\n\n#### 安装\n\n```shell\ncomposer require \"alicfeng/laravel-runtime\"\n```\n\n\n\n#### 配置\n\n- 在`config/app.php`配置中添加\n\n  ```php\n  AlicFeng\\Runtime\\ServiceProvider\\RuntimeServiceProvider::class\n  ```\n\n- 在`app/Http/Kernel.php`中添加中间件\n\n  ```php\n  \\AlicFeng\\Runtime\\Middleware\\RuntimeMiddleware::class\n  ```\n\n- 生成配置文件\n\n  ```shell\n  php artisan vendor:publish --provider=\"AlicFeng\\Runtime\\ServiceProvider\\RuntimeServiceProvider\"\n  ```\n\n\n\n#### 使用\n\n- `CLI`\n\n```shell\n#使用帮助\n➜ php artisan samego:runtime help\nusage:\nphp artisan samego:runtime [help] [--service {reload|analysis}] [--start] [--end]\n\n# 查看接口请求情况分析(支持时间段)\n➜ php artisan samego:runtime --service=analysis\n➜ php artisan samego:runtime --service=analysis --start={opition|strtotime|0}\n➜ php artisan samego:runtime --service=analysis --end={opition|strtotime|time()}\n\n# 分析数据重载\n➜ php artisan samego:runtime --service=reload\n```\n\n- `WEB`\n\n浏览器打开`$host/runtime/analysis`即可看到展示~\n\n\n\n#### tail日志\n\n```shell\n➜ tail -f storage/logs/laravel-2019-04-24.log\n[2019-04-24 11:38:44] production.INFO: trace request message begin  \n[2019-04-24 11:38:44] production.INFO: router  : order/v1/interface/name  \n[2019-04-24 11:38:44] production.INFO: method  : POST  \n[2019-04-24 11:38:44] production.INFO: ip      : 113.118.235.220  \n[2019-04-24 11:38:44] production.INFO: params  : {\"header\":{\"userToken\":\"token\"},\"body\":{\"param\":\"alicfeng\"}  \n[2019-04-24 11:38:44] production.INFO: trace request message end\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falicfeng%2Flaravel-runtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falicfeng%2Flaravel-runtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falicfeng%2Flaravel-runtime/lists"}