2017 © Pedro Peláez
 

project symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

image

symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  • Wednesday, August 16, 2017
  • by lastzero
  • Repository
  • 9 Watchers
  • 55 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 39 Versions
  • 5 % Grown

The README.md

License: MIT Build Status Documentation GitHub contributors Community Chat Twitter, (*1)

Symlex aims to simplify agile Web development by providing a working system that promotes best practices by example:, (*2)

  • Built on top of well documented and tested standard components
  • Contains everything to create full-featured Web applications: Service container, REST routing & Twig template engine
  • Strict use of dependency injection for configuration and bootstrapping
  • Small code and memory footprint
  • Extremely fast compared to other PHP frameworks, especially in combination with RoadRunner

Since its initial release in 2014, it has proven to be well suited for rapidly building microservices, CLI and single-page applications. It comes complete with working examples from testing to forms and database abstraction. Simply delete what you don't need., (*3)

The kernel is tiny and only creates a service container for bootstrapping your application within its context. Using a single container for configuration and dependency injection reduces complexity and leads to improved performance compared to other frameworks. It also prevents developers from thoughtlessly installing bundles without understanding them. The result is less bloat and simpler, more maintainable and testable code that is fundamental for agile development., (*4)

, (*5)

Plain classes are used wherever possible to avoid vendor lock-in and enable framework independent code reuse. See TRADEOFFS.md., (*6)

You can combine the PHP based backend with any JavaScript library or REST client. The front-end boilerplate is there for your convenience and puts you straight on track for building impressive single-page applications with Webpack and Vuetify, see demo.symlex.org. A working example for command line applications is included as well., (*7)

Our complete framework documentation can be found on docs.symlex.org. Tuzi Liu maintains a Chinese translation for us., (*8)

Note: https://github.com/symlex/symlex-core contains the kernel and routers as reusable components., (*9)

Setup

Before you start, make sure you have PHP 7.3+, Composer and Docker installed on your system (howto for Mac OS X). Run get-composer.sh to install composer locally on Linux. Instead of using Docker, you can set up your own runtime environment based on the existing Dockerfile. In addition, you will need a database plus nodejs and npm to build the frontend., (*10)

Step 1: Run composer to create a new Symlex project:, (*11)

composer create-project symlex/symlex myapp

Composer will ask for config values to generate app/config/parameters.yml for you., (*12)

Make sure storage/cache is writable so that cache files can be created by the app., (*13)

Step 2: Start RoadRunner and MariaDB using docker-compose:, (*14)

cd myapp
docker-compose up

Note: This configuration is for testing and development purposes only, see comments in docker-compose.yml for details. You might need to tweak it if you run Docker with a different user for security reasons. On OS X, the current release of Docker is really slow in executing PHP from the host's file system. docker-compose up -d runs Docker in the background, but you won't see helpful log messages in this case., (*15)

Step 3: Let Make initialize the database and build the front-end components for you:, (*16)

make terminal
make all database

To verify everything is working, run make test., (*17)

Note: You can also use this approach to execute other CLI commands later. Make should be pre-installed in typical Unix development environments - otherwise you might have to get it first e.g. by installing the Xcode Command Line Tools on OS X via xcode-select --install or by adding the build-base or build-essential package on Linux. The Makefile contains a list of all targets., (*18)

After successful installation, open the site at http://localhost:8081/ and log in as admin@example.com using the password passwd., (*19)

YAML files located in app/config configure the app based on parameters and services. The main config files are app/config/web.yml and app/config/console.yml., (*20)

If you add localhost-debug to your /etc/hosts and access the site with that, it will load in debug mode (you'll see a stack trace and other debug information on the error pages)., (*21)

The mailhog user interface is available at http://localhost:8025/. It can be used to receive and view mails automatically sent by the system, e.g. when new users are created., (*22)

If you want to build a more light-weight app, have a look at our other examples:, (*23)

  • https://github.com/symlex/rest-api
  • https://github.com/symlex/stream-sampler

Full documentation: https://docs.symlex.org/en/latest/framework/, (*24)

Login Screen, (*25)

RoadRunner

Symlex now includes RoadRunner - a high-performance PHP application server - as an alternative to NGINX. It will be automatically downloaded when you build the Docker image., (*26)

Our installation instructions for Symlex >= 4.4.0 won't work for previous releases as they still use NGINX and PHP-FPM. Instead of web and php, there is now a single app service powered by RoadRunner. If you prefer NGINX, you can use an older release or copy the previous config to the new release. Some of our example apps use NGINX as well., (*27)

About

Symlex is maintained by Michael Mayer and aims to simplify agile Web development by providing a working system that promotes best practices by example. Michael released his first PHP framework in 2001 and has worked with various major framework vendors in the past. Building this would not have been possible without a lot of prior work by other developers. Thank you to those and everyone who contributed!, (*28)

Choice is the enemy of productivity. Put another way, if your solution does everything, and has no opinions about anything, then it solves nothing. ― Asim Aslam, (*29)

Feel free to send an e-mail to hello@symlex.org if you have any questions, need commercial support or just want to say hello. We welcome contributions of any kind. If you have a bug or an idea, read our guide before opening an issue., (*30)

Performance

It's obvious that PHP framework performance mainly depends on the lines of code that have to be executed for each request. While Symlex was designed to be simple and lean, a good performance is a very important by-product of this approach., (*31)

The best code is no code. Where there is no code, there are no bugs. No API to learn. No awkward UI. The best refactors are deletions. ― Eric Elliott, (*32)

As published by phpbenchmarks.com, REST requests are more than 40% faster compared to other common PHP frameworks:, (*33)

Response times of popular PHP frameworks, (*34)

Note that these response times were measured in fully optimized production mode on fast server hardware with only 5 concurrent requests. In practice, differences might be much larger in terms of absolute time. Memory consumption should be considered as well:, (*35)

Memory footprint of popular PHP frameworks, (*36)

Why should you care? First, your users will love it. As a rule of thumb, 100 ms is about the limit for having them feel that the system is reacting instantaneously, meaning that no special feedback is necessary except to display the result. The total response time also includes network (~25 ms), browser and other overhead, which only leaves a small fraction of those 100 ms for implementing the actual business logic. Second, you'll save a lot of money for server infrastructure and developers are more productive as tests are running faster., (*37)

Relationship with Symfony and Silex

Symlex was started in 2014 as a simple Silex boilerplate, since Silex itself doesn't come with a "Standard Edition" that points you in the right direction. Using Silex instead of Symfony was recommended by SensioLabs (the creators of both frameworks) as a light-weight alternative to Symfony + FOSRestBundle for quickly building high-performance REST services and single-page Web applications., (*38)

It was soon noticed that Pimple - the service container that comes with Silex - feels cumbersome for developers coming from Symfony and makes it hard to reuse existing code. In addition, many Silex code examples and even real-world applications accessed the service container from all parts of the code (not only the framework itself), which circumvents inversion of control and leads to awkward testability. Symlex therefore promotes the strict use of dependency injection and combines the convenience of a full-fledged service container with the speed of a micro-framework., (*39)

Today, Symlex has its own routing component (based on Symfony 4) and does not use Silex anymore. The framework has proven to be useful for a large number of different applications. Some of them were based on the regular Symfony kernel before and did the change because they were drowning in complexity and suffered from response times well above 30 seconds in development mode. Symlex brought them back on track without big changes to their existing code base., (*40)

Micro-Kernel Architecture, (*41)

Donations

Symlex is a non-profit project run entirely by volunteers. You're most welcome to support us via GitHub Sponsors, especially if you need help with using our software. They will match every donation in the first year., (*42)

Please leave a star if you like this project, it provides additional motivation to keep going. Thank you very much! <3, (*43)

The Versions

16/08 2017

dev-master

9999999-dev https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

13/04 2017

v3.0.6

3.0.6.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

13/04 2017

v3.0.5

3.0.5.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

12/04 2017

v3.0.4

3.0.4.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

12/04 2017

v3.0.3

3.0.3.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

12/04 2017

v3.0.2

3.0.2.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

12/04 2017

v3.0.1

3.0.1.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

12/04 2017

v3.0.0

3.0.0.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

07/04 2017

v2.4.2

2.4.2.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

07/04 2017

v2.4.1

2.4.1.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

07/04 2017

v2.4.0

2.4.0.0 https://github.com/symlex/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

05/04 2017

v2.3.0

2.3.0.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

30/03 2017

v2.2.1

2.2.1.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

30/03 2017

v2.2.0

2.2.0.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

02/03 2017

v2.1.4

2.1.4.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

23/02 2017

v2.1.3

2.1.3.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

22/02 2017

v2.1.2

2.1.2.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

22/02 2017

v2.1.1

2.1.1.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

16/02 2017

v2.1.0

2.1.0.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

11/02 2017

v2.0.4

2.0.4.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

10/02 2017

v2.0.3

2.0.3.0 https://github.com/lastzero/symlex

A complete high-performance framework for building microservices, CLI and single-page apps based on Silex 2 and the Symfony DI container

  Sources   Download

MIT

The Requires

 

The Development Requires

dependency injection rest silex symfony performance micro-framework

08/02 2017
08/02 2017