Interview with Leo Cavalcante, full-stack developer

Siler interview: Making PHP easy and enjoyable

Madeleine Domogalla
© Shutterstock / Marie Maerz

Siler is a set of general purpose high-level abstractions aiming an API for declarative programming in PHP using the “keep it simple, stupid” principle. Its latest release, Siler 1.7.2 is here and we spoke to Leo Cavalcante about the library and what his top three favorite new features are. Let’s take a look.

JAXenter: Please give us an overview: What is siler?

Leo Cavalcante: Siler is a library to make things simpler using the KISS principle. Its goal is to make PHP easy and enjoyable like calling functions in files without compromising code quality.

JAXenter: How does it work?

Leo Cavalcante: It achieves that by favoring the functional paradigm approach to programming, making those functions as pure as possible, being strict about type-safety and exposing a declarative API.

It is also worth to mention that Siler works on a peer-dependency premise, you install just what and when you need, Siler itself has 0 dependencies (no-dev).

SEE ALSO: PHP to Hack, an Incrementally Typed Adventure at Slack

JAXenter: What are the advantages for developers who use this tool?

Leo Cavalcante: Pragmatic and easy. It’s like pure PHP, but with nicely arranged, unified and namespaced functions. You can skip tons of unused files, misleading xml/yaml configurations and enforced architectures.

It provides straightforward APIs for routes, functional programming, logging, Twig, mailing and mainly: Swoole, Ratchet, Laminas Stratigility (PSR-7/15), GraphQL and now gRPC.

    PHP Conference Whitepaper

    The ultimate PHP Knowledge

    PHP Whitepaper Selection

    In our exclusive IPC Whitepaper Selection, we have compiled over 40 pages of combined knowledge. Here you will find everything about the topics Security, PHP Core, Architecture, PHP Frameworks, CMS, and Web Development. Download it to be able to expand your expertise about what’s happening in the world of PHP.


JAXenter: Siler 1.7.2 has been released: Which three features are among your personal highlights?

Leo Cavalcante: 1. The gRPC server capability, it’s on an early stage, only unary request-response for now, but I like the potential (example) since Siler’s lightweight and simplicity makes it a good call for micro-services.

2. The new functional constructs. They are helping me a lot to make a functional/declare code:

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

$pipeline = λ\pipe([
λ\lmap(fn (string $s): string => trim($s)),

echo $pipeline(['foo', ' ', 'bar', 'baz']); // foo,bar

3. And the typed array_gets avoids more type annotations for PhpStorm’s and Psalm’s static analyzers, it helps them infer what you expect in an associative array.

SEE ALSO: PHP 8 interview: “JIT will bring the language to a whole new level”

JAXenter: What plans do you have for the future of the tool?

Leo Cavalcante: For the near future: GraphQL’s Custom Directives are being discussed here.

And I’m planning something for databases/persistence, there are good players like Eloquent and Doctrine, but I’m not keen to ORMs, especially ActiveRecord ones.

I’m drafting an implementation that is between a DataMapper and a TableGateway, fully convention-over-configuration and adapted for Swoole’s MySQL and Postgres Coroutine clients, beyond PDO, but just started this week, nothing relevant to show yet.

Thank you very much!

Madeleine Domogalla

Madeleine Domogalla

All Posts by Madeleine Domogalla

Madeleine Domogalla has been an editor at S&S-Media since 2018. Previously she studied German Language and Literature at the Rheinische Friedrich-Wilhelms-Universität Bonn.

Inline Feedbacks
View all comments