PHPackages                             leocavalcante/siler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. leocavalcante/siler

AbandonedArchivedLibrary[Framework](/categories/framework)

leocavalcante/siler
===================

Siler is a set of general purpose high-level abstractions aiming an API for declarative programming in PHP.

v1.7.9(5y ago)1.1k67.6k↓50.9%91[14 issues](https://github.com/leocavalcante/siler/issues)[14 PRs](https://github.com/leocavalcante/siler/pulls)4MITPHPPHP &gt;=7.3 || &gt;= 8.0

Since Mar 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/leocavalcante/siler)[ Packagist](https://packagist.org/packages/leocavalcante/siler)[ GitHub Sponsors](https://github.com/leocavalcante)[ RSS](/packages/leocavalcante-siler/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (23)Versions (35)Used By (4)

> ⚠️ 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.

**As an alternative for Siler, something lightweight and simple that works as a library with Swoole out-of-the-box, I highly recommend Nano! Check it out: **

---

 [![](siler.png)](siler.png)

[![Build](https://github.com/leocavalcante/siler/workflows/CI/badge.svg)](https://github.com/leocavalcante/siler/actions)[![codecov](https://camo.githubusercontent.com/ceb189a8ca924c982fb7e443f357cb087d32954e995e1d7cb277472382f7c216/68747470733a2f2f636f6465636f762e696f2f67682f6c656f636176616c63616e74652f73696c65722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/leocavalcante/siler)[![Psalm coverage](https://camo.githubusercontent.com/561e2d8fe1ee63c6870d6db84953120358d51cea98e27efa5b9ed767972f6e1a/68747470733a2f2f73686570686572642e6465762f6769746875622f6c656f636176616c63616e74652f73696c65722f636f7665726167652e7376673f)](https://shepherd.dev/github/leocavalcante/siler)[![Latest Stable Version](https://camo.githubusercontent.com/a9deda298649a6e38fcd13823efd986076adf7a59fff3bd91cb346a2d78c7f0f/68747470733a2f2f706f7365722e707567782e6f72672f6c656f636176616c63616e74652f73696c65722f762f737461626c65)](https://packagist.org/packages/leocavalcante/siler)[![Total Downloads](https://camo.githubusercontent.com/f92b1d2b5259c6d0992fc3af9fcf7752b31fb81a9d88ca678c494db5de2011ed/68747470733a2f2f706f7365722e707567782e6f72672f6c656f636176616c63616e74652f73696c65722f646f776e6c6f616473)](https://packagist.org/packages/leocavalcante/siler)[![License](https://camo.githubusercontent.com/5a298544dba1273e6f7f087e9e6de21f2e1f0d84dea82f061a6a1ba9a42a1a21/68747470733a2f2f706f7365722e707567782e6f72672f6c656f636176616c63616e74652f73696c65722f6c6963656e7365)](https://packagist.org/packages/leocavalcante/siler)

Siler is a set of general purpose high-level abstractions aiming an API for declarative programming in PHP.

- 💧 **Files and functions** as first-class citizens
- 🔋 **Zero dependency**, everything is on top of PHP built-in functions
- ⚡ **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)

Use with [Swoole](https://www.swoole.co.uk/)
--------------------------------------------

[](#use-with-swoole)

Flat files and plain-old PHP functions rocking on a production-grade, high-performance, scalable, concurrent and non-blocking HTTP server.

[Read the tutorial.](https://siler.leocavalcante.com/swoole)

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

```
composer require leocavalcante/siler
```

That 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.

### Hello, World!

[](#hello-world)

```
use Siler\Functional as λ; // Just to be cool, don't use non-ASCII identifiers ;)
use Siler\Route;

Route\get('/', λ\puts('Hello, World!'));
```

Nothing more, nothing less. You don't need even tell Siler to `run` or something like that (`puts` works like a lazily evaluated `echo`).

#### JSON

[](#json)

```
use Siler\Route;
use Siler\Http\Response;

Route\get('/', fn() => Response\json(['message' => 'Hello, World!']));
```

The `Response\json` function will automatically add `Content-type: application/json` in the response headers.

### Swoole

[](#swoole)

Siler provides first-class support for Swoole. You can regularly use `Route`, `Request` and `Response` modules for a Swoole HTTP server.

```
use Siler\Http\Response;
use Siler\Route;
use Siler\Swoole;

$handler = function () {
    Route\get('/', fn() => Response\json('Hello, World!'));
};

$port = 8000;
echo "Listening on port $port\n";
Swoole\http($handler, $port)->start();
```

### GraphQL

[](#graphql)

Install peer-dependency:

```
composer require webonyx/graphql-php
```

#### Schema-first

[](#schema-first)

```
type Query {
    hello: String
}
```

```
use Siler\Route;
use Siler\GraphQL;

$type_defs = file_get_contents(__DIR__ . '/schema.graphql');
$resolvers = [
    'Query' => [
        'hello' => fn ($root, $args, $context, $info) => 'Hello, World!'
    ]
];

$schema = GraphQL\schema($type_defs, $resolvers);

Route\post('/graphql', fn() => GraphQL\init($schema));
```

#### Code-first

[](#code-first)

Another peer-dependency:

```
composer require doctrine/annotations
```

Then:

```
/**
 * @\Siler\GraphQL\Annotation\ObjectType()
 */
final class Query
{
    /**
     * @\Siler\GraphQL\Annotation\Field()
     */
    public static function hello($root, $args, $context, $info): string
    {
        return 'Hello, World!';
    }
}
```

```
use Siler\GraphQL;
use Siler\Route;

$schema = GraphQL\annotated([Query::class]);

Route\post('/graphql', fn() => GraphQL\init($schema));
```

Object 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).

What is next?
-------------

[](#what-is-next)

- [Documentation](https://siler.leocavalcante.dev/)
- [Examples](https://github.com/siler-examples)

License
-------

[](#license)

[![License](https://camo.githubusercontent.com/4a2a89f6ee30a8cf13a0acb3178b5a692827b1fb23f0111434e55ac2658b2ae9/687474703a2f2f696d672e736869656c64732e696f2f3a4c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/leocavalcante/siler/blob/master/LICENSE)

- **[MIT license](http://opensource.org/licenses/mit-license.php)**
- Copyright 2020 © [LC](https://leocavalcante.dev)

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 57.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~49 days

Recently: every ~32 days

Total

22

Last Release

1982d ago

PHP version history (4 changes)v1.0.0PHP &gt;=7.1

v1.5.0PHP &gt;=7.2

1.7.0PHP &gt;=7.3

v1.7.9PHP &gt;=7.3 || &gt;= 8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/183722?v=4)[Leo Cavalcante](/maintainers/leocavalcante)[@leocavalcante](https://github.com/leocavalcante)

---

Top Contributors

[![leocavalcante](https://avatars.githubusercontent.com/u/183722?v=4)](https://github.com/leocavalcante "leocavalcante (1211 commits)")[![kodiakhq[bot]](https://avatars.githubusercontent.com/in/29196?v=4)](https://github.com/kodiakhq[bot] "kodiakhq[bot] (433 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (208 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (204 commits)")[![gskierk](https://avatars.githubusercontent.com/u/42655090?v=4)](https://github.com/gskierk "gskierk (15 commits)")[![trollboy](https://avatars.githubusercontent.com/u/1096923?v=4)](https://github.com/trollboy "trollboy (3 commits)")[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (2 commits)")[![eghojansu](https://avatars.githubusercontent.com/u/10484419?v=4)](https://github.com/eghojansu "eghojansu (2 commits)")[![hadron43](https://avatars.githubusercontent.com/u/55682057?v=4)](https://github.com/hadron43 "hadron43 (1 commits)")[![juliend2](https://avatars.githubusercontent.com/u/30395?v=4)](https://github.com/juliend2 "juliend2 (1 commits)")[![marcokuoni](https://avatars.githubusercontent.com/u/31818381?v=4)](https://github.com/marcokuoni "marcokuoni (1 commits)")[![michaelphipps](https://avatars.githubusercontent.com/u/457561?v=4)](https://github.com/michaelphipps "michaelphipps (1 commits)")[![muglug](https://avatars.githubusercontent.com/u/2292638?v=4)](https://github.com/muglug "muglug (1 commits)")[![petemcfarlane](https://avatars.githubusercontent.com/u/3472717?v=4)](https://github.com/petemcfarlane "petemcfarlane (1 commits)")[![pokemaobr](https://avatars.githubusercontent.com/u/1239099?v=4)](https://github.com/pokemaobr "pokemaobr (1 commits)")[![quadrifolia](https://avatars.githubusercontent.com/u/630635?v=4)](https://github.com/quadrifolia "quadrifolia (1 commits)")[![R-J](https://avatars.githubusercontent.com/u/3996187?v=4)](https://github.com/R-J "R-J (1 commits)")[![SauliusUgintas](https://avatars.githubusercontent.com/u/37797480?v=4)](https://github.com/SauliusUgintas "SauliusUgintas (1 commits)")[![segy](https://avatars.githubusercontent.com/u/1355459?v=4)](https://github.com/segy "segy (1 commits)")[![spawnia](https://avatars.githubusercontent.com/u/12158000?v=4)](https://github.com/spawnia "spawnia (1 commits)")

---

Tags

flat-filesfunctionalgraphqlhacktoberfesthttphttp2librarymicro-frameworkphppsalmpsr-11psr-15psr-2psr-4psr-7routingsilerswoolewebsocketsapiframeworkgraphqlmicrorouterswoolefunctional

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/leocavalcante-siler/health.svg)

```
[![Health](https://phpackages.com/badges/leocavalcante-siler/health.svg)](https://phpackages.com/packages/leocavalcante-siler)
```

###  Alternatives

[slim/slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

12.3k52.9M1.4k](/packages/slim-slim)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
