{"id":13405240,"url":"https://github.com/leocavalcante/siler","last_synced_at":"2025-09-28T20:30:31.786Z","repository":{"id":13923329,"uuid":"75350712","full_name":"leocavalcante/siler","owner":"leocavalcante","description":"⚡ Flat-files and plain-old PHP functions rockin'on as a set of general purpose high-level abstractions.","archived":true,"fork":false,"pushed_at":"2022-02-13T14:04:09.000Z","size":6091,"stargazers_count":1116,"open_issues_count":28,"forks_count":90,"subscribers_count":50,"default_branch":"main","last_synced_at":"2024-12-18T19:11:00.954Z","etag":null,"topics":["flat-files","functional","graphql","hacktoberfest","http","http2","library","micro-framework","php","psalm","psr-11","psr-15","psr-2","psr-4","psr-7","routing","siler","swoole","websockets"],"latest_commit_sha":null,"homepage":"https://siler.leocavalcante.dev","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/leocavalcante.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null},"funding":{"github":["leocavalcante"]}},"created_at":"2016-12-02T02:01:48.000Z","updated_at":"2024-12-12T18:31:59.000Z","dependencies_parsed_at":"2022-08-07T07:15:57.446Z","dependency_job_id":null,"html_url":"https://github.com/leocavalcante/siler","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocavalcante%2Fsiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocavalcante%2Fsiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocavalcante%2Fsiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocavalcante%2Fsiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leocavalcante","download_url":"https://codeload.github.com/leocavalcante/siler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234556229,"owners_count":18851921,"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":["flat-files","functional","graphql","hacktoberfest","http","http2","library","micro-framework","php","psalm","psr-11","psr-15","psr-2","psr-4","psr-7","routing","siler","swoole","websockets"],"created_at":"2024-07-30T19:01:57.779Z","updated_at":"2025-09-28T20:30:26.272Z","avatar_url":"https://github.com/leocavalcante.png","language":"PHP","readme":"\u003e ⚠️ I'm afraid that I'm not being able to keep Siler up-to-date as it deserves, so it's repository has been archived.\n\n**As an alternative for Siler, something lightweight and simple that works as a library with Swoole out-of-the-box, I highly recommend Nano!\nCheck it out: https://nano.hyperf.wiki/#/en/**\n\n---\n\n\u003cp align=\"center\"\u003e\n    \u003cbr\u003e\u003cbr\u003e\n    \u003cimg src=\"siler.png\" height=\"100\"/\u003e\n    \u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n[![Build](https://github.com/leocavalcante/siler/workflows/CI/badge.svg)](https://github.com/leocavalcante/siler/actions)\n[![codecov](https://codecov.io/gh/leocavalcante/siler/branch/master/graph/badge.svg)](https://codecov.io/gh/leocavalcante/siler)\n[![Psalm coverage](https://shepherd.dev/github/leocavalcante/siler/coverage.svg?)](https://shepherd.dev/github/leocavalcante/siler)\n[![Latest Stable Version](https://poser.pugx.org/leocavalcante/siler/v/stable)](https://packagist.org/packages/leocavalcante/siler)\n[![Total Downloads](https://poser.pugx.org/leocavalcante/siler/downloads)](https://packagist.org/packages/leocavalcante/siler)\n[![License](https://poser.pugx.org/leocavalcante/siler/license)](https://packagist.org/packages/leocavalcante/siler)\n\nSiler is a set of general purpose high-level abstractions aiming an API for declarative programming in PHP.\n\n* 💧 **Files and functions** as first-class citizens\n* 🔋 **Zero dependency**, everything is on top of PHP built-in functions\n* ⚡ **Blazing fast**, no additional overhead - [*benchmark 1*](https://github.com/kenjis/php-framework-benchmark#results), [*benchmark 2*](https://qiita.com/prograti/items/01eac3d20f1447a7b2f9) and [*benchmark 3*](https://github.com/the-benchmarker/web-frameworks)\n\n## Use with [Swoole](https://www.swoole.co.uk/)\n\nFlat files and plain-old PHP functions rocking on a production-grade, high-performance, scalable, concurrent and non-blocking HTTP server.\n\n[Read the tutorial.](https://siler.leocavalcante.com/swoole)\n\n## Getting started\n\n### Installation\n\n```bash\ncomposer require leocavalcante/siler\n```\n\nThat is it. Actually, Siler is a library, not a framework (maybe a micro-framework), the overall program flow of control is dictated by you. So, no hidden configs or predefined directory structures.\n\n### Hello, World!\n\n```php\nuse Siler\\Functional as λ; // Just to be cool, don't use non-ASCII identifiers ;)\nuse Siler\\Route;\n\nRoute\\get('/', λ\\puts('Hello, World!'));\n```\nNothing more, nothing less. You don't need even tell Siler to `run` or something like that (`puts` works like a lazily evaluated `echo`).\n\n#### JSON\n\n```php\nuse Siler\\Route;\nuse Siler\\Http\\Response;\n\nRoute\\get('/', fn() =\u003e Response\\json(['message' =\u003e 'Hello, World!']));\n```\n\nThe `Response\\json` function will automatically add `Content-type: application/json` in the response headers.\n\n### Swoole\n\nSiler provides first-class support for Swoole. You can regularly use `Route`, `Request` and `Response` modules for a Swoole HTTP server.\n\n```php\nuse Siler\\Http\\Response;\nuse Siler\\Route;\nuse Siler\\Swoole;\n\n$handler = function () {\n    Route\\get('/', fn() =\u003e Response\\json('Hello, World!'));\n};\n\n$port = 8000;\necho \"Listening on port $port\\n\";\nSwoole\\http($handler, $port)-\u003estart();\n```\n\n### GraphQL\n\nInstall peer-dependency:\n\n```bash\ncomposer require webonyx/graphql-php\n```\n\n#### Schema-first\n\n```graphql\ntype Query {\n    hello: String\n}\n```\n\n```php\nuse Siler\\Route;\nuse Siler\\GraphQL;\n\n$type_defs = file_get_contents(__DIR__ . '/schema.graphql');\n$resolvers = [\n    'Query' =\u003e [\n        'hello' =\u003e fn ($root, $args, $context, $info) =\u003e 'Hello, World!'\n    ]\n];\n\n$schema = GraphQL\\schema($type_defs, $resolvers);\n\nRoute\\post('/graphql', fn() =\u003e GraphQL\\init($schema));\n```\n\n#### Code-first\n\nAnother peer-dependency:\n\n```bash\ncomposer require doctrine/annotations\n```\n\nThen:\n\n```php\n/**\n * @\\Siler\\GraphQL\\Annotation\\ObjectType()\n */\nfinal class Query\n{\n    /**\n     * @\\Siler\\GraphQL\\Annotation\\Field()\n     */\n    public static function hello($root, $args, $context, $info): string\n    {\n        return 'Hello, World!';\n    }\n}\n```\n\n```php\nuse Siler\\GraphQL;\nuse Siler\\Route;\n\n$schema = GraphQL\\annotated([Query::class]);\n\nRoute\\post('/graphql', fn() =\u003e GraphQL\\init($schema));\n```\n\nObject type name will be guessed from class name, same for field name, and it's return type (i.e.: PHP `string` scalar `===` GraphQL `String` scalar).\n\n## What is next?\n\n- [Documentation](https://siler.leocavalcante.dev/)\n- [Examples](https://github.com/siler-examples)\n\n## License\n\n[![License](http://img.shields.io/:License-MIT-blue.svg?style=flat-square)](https://github.com/leocavalcante/siler/blob/master/LICENSE)\n\n- **[MIT license](http://opensource.org/licenses/mit-license.php)**\n- Copyright 2020 © \u003ca href=\"https://leocavalcante.dev\" target=\"_blank\"\u003eLC\u003c/a\u003e\n","funding_links":["https://github.com/sponsors/leocavalcante"],"categories":["开源项目","Libraries","PHP","Frameworks","Uncategorized","Implementations","Framework"],"sub_categories":["PHP Libraries","Uncategorized","PHP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocavalcante%2Fsiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleocavalcante%2Fsiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocavalcante%2Fsiler/lists"}