Download the PHP package nyholm/super-slim without Composer

On this page you can find all versions of the php package nyholm/super-slim. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package super-slim

Nyholm's SuperSlim framework

The quickest and best framework you can start building on.

The idea

The idea of this framework is to give you a good foundation to start building your application. No file is sacred in this framework. It is you as a developer that are responsible for code and the dependencies you use.

If you eventually outgrow this framework, just replace Kernel.php with Symfony's Kernel and you are running a Symfony 4 application.

Performance

Below is a table of comparisons using a "hello world" application.

Name Time Memory
SuperSlim 6.71 ms 168 kB
Slim 3.1 11.8 ms 292 kB
Symfony 4.2 14.7 ms 567 kB
Zend Expressive 3.2 16.1 ms 404 kB
Laravel 5.7 85.3 ms 2160 kB

Looking only at "hello world" is not a good measurement for performance of a framework. You have to consider how well a large application is performing, specifically your large application. You do also have to consider how quick you can develop in a framework.

The table above is interesting if you are planning to build a small microservice that are similar to "hello world".

The architecture

The framework is quite simple, it consists of less than 5 classes. It follows the Middleware pattern and supports Symfony's HTTP Foundation.

index.php

Frontend controller, its job is to create a Request and give it to the Kernel.

Kernel

It creates a container from cache or from config then starts the Runner.

Runner

Runs the chain of middleware one by one in the order they are defined in the service declaration of App\Runner in services.yaml. The last middleware should be the router that calls one of your controller. The router will return a Response.

When the router middleware has returned a response the middleware will run again but backwards.

Router

The framework ships with two routers: App\Middleware\Router and App\Middleware\RouterForComplexRoutes. The former is using just simple if-statements to match the route with a controller. This is by far the quickest way if you only got a few routes. If you have more complex preg_match routing or a great number of them, you might be better of with RouterForComplexRoutes. It uses the Symfony 4 router which is the fastest generic router written in PHP.

Make sure you profile your application to see which router fits you better.

Controller

Here are your normal PHP classes and normal code. Your controllers should always return a Response.

Services

You are free to create how many services, value objects, database entities as you want. You can use config/services.yaml to register your services. By default they are autowired with the Symfony Dependency Injection container.

Configuration

It is simple to configure the application. You can use environment variables or the .env files for host specific configuration. If you want to register services or modify behavior then check the config/ folder.

If you know your way around Symfony configuration then you wont have any problem configuring SuperSlim.

Database

Your application may want to use a database. Just pick your favorite way to connect to your database and register it as a service. Here is an example using Doctrine.

If you want to enable CLI support:

Templating

Returning new Response('Hello world'); is not very fun. You probably want to use some templating. Pick you favorite tool and just register it as a service. Here is an example using Twig.

Cache

Since you are building a small and super fast app, then caching is probably very important to you. Pick your favorite cache library and just register it as a service. Here is an example using Symfony Cache.

Configure an alias for CacheInterface to use Memcached in production.

In development we want to use the Void cache.

Then use the built in App\Middleware\Cache to cache each URL. Feel free to improve the creation of the cache key and other logic in this class.

The future of this framework

This small project is obviously not a competitor to any of the large frameworks and it should never be treated like that. It is just an exercise to show how easy it is to build small application based on Symfony components. And if one is using an architecture similar to SuperSlim there will not be any issues upgrading to a full Symfony framework when needed in the future.

I will treat this as a hobby project. If you like it, give it a star and fork it to turn it into something you like.

Or, you could read these great articles and build your own framework.


All versions of super-slim with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
psr/cache Version ^1.0
symfony/config Version ^4.2
symfony/dependency-injection Version ^4.2
symfony/flex Version ^1.2
symfony/http-foundation Version ^4.2
symfony/yaml Version ^4.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nyholm/super-slim contains the following files

Loading the files please wait ....