{"id":28425530,"url":"https://github.com/minbaby/php-ext-startup","last_synced_at":"2025-06-26T11:32:40.179Z","repository":{"id":55636442,"uuid":"156516165","full_name":"minbaby/php-ext-startup","owner":"minbaby","description":"php-ext-startup php-extension startup","archived":false,"fork":false,"pushed_at":"2020-12-16T10:36:16.000Z","size":295,"stargazers_count":5,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"feature/stringy","last_synced_at":"2025-06-05T10:50:36.269Z","etag":null,"topics":["extension","kahlan","php","startup"],"latest_commit_sha":null,"homepage":"https://minbaby.github.io","language":"C","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/minbaby.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":"2018-11-07T08:43:45.000Z","updated_at":"2023-05-08T02:56:56.000Z","dependencies_parsed_at":"2022-08-15T05:10:15.822Z","dependency_job_id":null,"html_url":"https://github.com/minbaby/php-ext-startup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/minbaby/php-ext-startup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minbaby%2Fphp-ext-startup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minbaby%2Fphp-ext-startup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minbaby%2Fphp-ext-startup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minbaby%2Fphp-ext-startup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minbaby","download_url":"https://codeload.github.com/minbaby/php-ext-startup/tar.gz/refs/heads/feature/stringy","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minbaby%2Fphp-ext-startup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262056255,"owners_count":23251638,"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":["extension","kahlan","php","startup"],"created_at":"2025-06-05T10:37:43.652Z","updated_at":"2025-06-26T11:32:40.172Z","avatar_url":"https://github.com/minbaby.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 学习 php 扩展\n\n[![CircleCI](https://circleci.com/gh/minbaby/php-ext-startup/tree/master.svg?style=svg)](https://circleci.com/gh/minbaby/php-ext-startup/tree/master)\n[![xcxc](https://img.shields.io/github/license/minbaby/php-ext-startup.svg)](https://github.com/minbaby/php-ext-startup/blob/master/README.MD)\n[![codecov](https://codecov.io/gh/minbaby/php-ext-startup/branch/master/graph/badge.svg)](https://codecov.io/gh/minbaby/php-ext-startup)\n\n## 基本思路\n\n1. 先写测试用例\n2. 再用 php 实现\n3. 再用 ext 实现\n4. 跑测试\n\n## 测试思路\n\n利用 php [自动加载](http://www.php.net/manual/zh/language.oop5.autoload.php)的逻辑。\n\n1. ~~默认禁用扩展执行一遍测试，这个时候执行的是 PHP 逻辑~~\n2. ~~启用扩展再执行一次扩展，　这个时候执行的是 EXT 逻辑 (这个地方有个问题，如果 ext 扩展不存在，那么就会降级使用 php 代码)~~\n\n使用函数动态生成对应的\b带有命名空间的类名，原因是之前的思路存在漏洞，\b因为自动加载的存在，导致如果 ext 中不存在，就会自动降级为 php 代码。\n\n## 学习方式\n\n如果我们需要查看这个项目，那么思路是什么的？\n\n1. 先看 `spec/` 这些文件的测试用例。\n2. 查看 `src/Minbaby/` 目录下的 php 实现\n3. 查看 `src/ext` 目录下的 c 实现\n\n## 常用命令\n\n1. 测试所有\n\n```bash\ncomposer run test\n# or\nmake ext-first\n```\n\n2. 测试 php 部分代码\n\n```bash\ncomposer run test-php\n# or\nmake ext-test\n```\n\n3. 测试 ext 部分代码\n\n```bash\ncomposer run test-ext\n# or\nmake ext-test-ext\n```\n\n4. 其他命令\n\n```bash\nmake ext-clean # clean code\n\nmake ext-fetch # fetch configure ext code from github\n\nmake ext-prepare # phpize \u0026 configure\n\nmake ext-buidl\n```\n\n\n## TODO\n\n- [ ] [stringy](https://github.com/danielstjules/Stringy)\n\n## 说明\n\n- 本项目只是学习实践使用\n- 使用 `@` 抑制符不是一个好习惯，尽量不要使用。\n- 依赖 `mb_string` 扩展\n\n## 已知问题\n\n- 0.0 很多\n- memory leak (可能使用改方案来排查 https://github.com/arnaud-lb/php-memory-profiler)\n\n### skip ci\n\n- `[skip ci]`\n- `[ci skip]`\n\n### 参考\n\n- [phpbook](https://github.com/walu/phpbook)\n- [Kahlan](https://kahlan.github.io/docs/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminbaby%2Fphp-ext-startup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminbaby%2Fphp-ext-startup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminbaby%2Fphp-ext-startup/lists"}