[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8494":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":22,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":27,"discoverSource":28},8494,"fractal","thephpleague\u002Ffractal","thephpleague","Output complex, flexible, AJAX\u002FRESTful data structures.","fractal.thephpleague.com",null,"PHP",3546,345,84,49,0,2,29.62,"MIT License",false,"master",true,[],"2026-06-12 02:01:54","# Fractal\n\n[![Latest Version](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fthephpleague\u002Ffractal.svg?style=flat-square)](https:\u002F\u002Fgithub.com\u002Fthephpleague\u002Ffractal\u002Freleases)\n[![Software License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n![The PHP League Tests](https:\u002F\u002Fgithub.com\u002Fthephpleague\u002Ffractal\u002Fworkflows\u002FThe%20PHP%20League%20Tests\u002Fbadge.svg)\n[![Total Downloads](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdt\u002Fleague\u002Ffractal.svg?style=flat-square)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fleague\u002Ffractal)\n\nFractal provides a presentation and transformation layer for complex data output, the like found in\nRESTful APIs, and works really well with JSON. Think of this as a view layer for your JSON\u002FYAML\u002Fetc.\n\nWhen building an API it is common for people to just grab stuff from the database and pass it\nto `json_encode()`. This might be passable for \"trivial\" APIs but if they are in use by the public,\nor used by mobile applications then this will quickly lead to inconsistent output.\n\n## Goals\n\n* Create a protective shield between source data and output, so schema changes do not affect users\n* Systematic type-casting of data, to avoid `foreach()`ing through and `(bool)`ing everything\n* Include (a.k.a embedding, nesting or side-loading) relationships for complex data structures\n* Work with standards like HAL and JSON-API but also allow custom serialization\n* Support the pagination of data results, for small and large data sets alike\n* Generally ease the subtle complexities of outputting data in a non-trivial API\n\nThis package is compliant with [PSR-1], [PSR-2] and [PSR-4]. If you notice compliance oversights,\nplease send a patch via pull request.\n\n[PSR-1]: https:\u002F\u002Fgithub.com\u002Fphp-fig\u002Ffig-standards\u002Fblob\u002Fmaster\u002Faccepted\u002FPSR-1-basic-coding-standard.md\n[PSR-2]: https:\u002F\u002Fgithub.com\u002Fphp-fig\u002Ffig-standards\u002Fblob\u002Fmaster\u002Faccepted\u002FPSR-2-coding-style-guide.md\n[PSR-4]: https:\u002F\u002Fgithub.com\u002Fphp-fig\u002Ffig-standards\u002Fblob\u002Fmaster\u002Faccepted\u002FPSR-4-autoloader.md\n\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require league\u002Ffractal\n```\n\n## Requirements\n\nThe following versions of PHP are supported by this version:\n\n&gt;= PHP 7.4\n\n## Documentation\n\nFractal has [full documentation](http:\u002F\u002Ffractal.thephpleague.com), powered by [Jekyll](http:\u002F\u002Fjekyllrb.com\u002F).\n\nContribute to this documentation in the [gh-pages branch](https:\u002F\u002Fgithub.com\u002Fthephpleague\u002Ffractal\u002Ftree\u002Fgh-pages\u002F).\n\n## Todo\n\n- add HAL serializers\n\n## Testing\n\n``` bash\n$ phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https:\u002F\u002Fgithub.com\u002Fthephpleague\u002Ffractal\u002Fblob\u002Fmaster\u002FCONTRIBUTING.md) and [CONDUCT](https:\u002F\u002Fgithub.com\u002Fthephpleague\u002Ffractal\u002Fblob\u002Fmaster\u002FCONDUCT.md) for details.\n\n\n## Maintainers\n\n- [Korvin Szanto](https:\u002F\u002Fgithub.com\u002Fkorvinszanto)\n- [Matt Trask](https:\u002F\u002Fgithub.com\u002Fmatthewtrask)\n\n## Credits\n\n- [Graham Daniels](https:\u002F\u002Fgithub.com\u002Fgreydnls)\n- [Andrew Willis](https:\u002F\u002Fgithub.com\u002Fwillishq)\n- [Phil Sturgeon](https:\u002F\u002Fgithub.com\u002Fphilsturgeon)\n- [All Contributors](https:\u002F\u002Fgithub.com\u002Fthephpleague\u002Ffractal\u002Fcontributors)\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](https:\u002F\u002Fgithub.com\u002Fthephpleague\u002Ffractal\u002Fblob\u002Fmaster\u002FLICENSE) for more information.\n","thephpleague\u002Ffractal 是一个用于输出复杂、灵活的 AJAX\u002FRESTful 数据结构的 PHP 库。它提供了一个数据展示和转换层，特别适用于 RESTful API 的 JSON 输出。Fractal 的核心功能包括为源数据与输出之间创建保护层以应对模式变更，系统化地进行数据类型转换，支持嵌套关系的数据结构，兼容 HAL 和 JSON-API 标准的同时允许自定义序列化，并且支持数据结果分页。此库遵循 PSR-1、PSR-2 和 PSR-4 规范，确保了代码的一致性和可维护性。适用于需要构建对外公开或被移动应用使用的非简单API场景中，帮助开发者轻松处理数据输出时遇到的细微复杂问题。","2026-06-11 03:18:17","top_language"]