Siler interview: Making PHP easy and enjoyable

Share
  • March 12, 2020

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.

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 SilerFunctional as λ; // Just to be cool, don't use non-ASCII identifiers ;)

$pipeline = λpipe([
λlmap(fn (string $s): string => trim($s)),
λlfilter(λnot(λequal('baz'))),
λnon_empty,
λljoin(',')
]);

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!

The post Siler interview: Making PHP easy and enjoyable appeared first on JAXenter.

Source : JAXenter