Download the PHP package wondernetwork/slim-kernel without Composer

On this page you can find all versions of the php package wondernetwork/slim-kernel. 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 slim-kernel

Wonder Slim Kernel

This package aims to provide a set of configuration helpers for Slim v4 microframework. By using the KernelBuilder, one can easily bootstrap the Slim\App service, along with a DI\Container dependency injection container, declaratively define a bunch of services, register symfony console commands, middlewares, routes, etc.

See basic usage to get an overview how to use it.

Installation

Basic Usage

Declarative service definitions

As mentioned in the basic usage section, the KernelBuilder has a glob() method, which accepts a list of glob patterns that will be used to build the container. Each of the matched php files needs to return either of:

Example:

On Startup hooks

You might want some initialization code to run on each request and each invocation of a CLI command. This is best place to setup some global error handlers, boot some static properties, etc. To do so, pass an object implementing StartupHook to the onStartup() method

Routes Startup Hook

WonderNetwork\SlimKernel\StartupHook\RouteStartupHook

If you would like to get your routes registered in a declarative manner, use this startup hook to point to files containing your route definitions. Each of the files matched by the glob pattern needs to return a closure, which takes Slim\App, or more precisely Slim\Interfaces\RouteCollectorProxyInterface. This means you can use it for more than routes: for example global middlewares. The closures will be evaluated on a Slim Application fetched from the container.

Error handling

The default error handling middleware is added. It’s configured to silently log errors with details, but do not display the details in the response. You can change that behavour, for example if you’d like to have more verbose logging in certain environments, by overriding the ErrorMiddlewareConfiguration service:

Beside the factory methods (either silent() or verbose()) you can also just create() and set each individual setting using with*() and without*() methods.

Service Factory

WonderNetwork\SlimKernel\ServiceFactory

This represents a more advanced service definition than a simple array, by passing in a ServiceBuilder instance. It’s helpful to use it when you’d like to autowire a bunch of files matching a pattern, or handle a list of configuration files with some post-processing.

You can also add service factories directly using the KernelBuilder::register() method.

See the following list of provided Service Factories for inspiration:

Slim Applcation Service Factory

This service factory is built-in and gets registered automatically. It defines the Slim\App service by using the PHP DI Slim Bridge.

Symfony Command Service Factory

WonderNetwork\SlimKernel\ServiceFactory\SymfonyConsoleServiceFactory

This service factory will find all files matching a specified glob pattern, autowire them in the container, and then register a Symfony console application with all these commands added to it.

[!NOTE] Make sure that your command classes are autoloaded using a valid PSR-4 configuration in your composer.json file

Convenience methods to access strongly typed input argumets

This package is aimed at accessing trusted payloads. In other words, it does not aim at validating an unknown payload, but rather asserts that the structure is correct, so that we can use semantic methods to get strong type guarantees. The package does not try to handle any situation -- except for basic type casting, it throws if it encounters some unexpected input.

Array Accessor

Fingers Crossed CLI handler

For all those pesky cron jobs, where on one hand you’d like to silence the output because it causes noisy emails for no reason, but at the same time you don’t want to lose context when something bad happens. Wrap your commands in a FingersCrossedHandler like so:

The output will be silenced except for the following situatios:

In the former case, the output will be written in realtime, and in the two latter ones you can expect it writtein in bulk at the end.

Input parsing

In order to simplify input parsing, you can use the Symfony Serializer component to automatically denormalize parsed request body or get params to a data transfer object of your choice. In your controller, simply mark one of the parameters with #[Payload] attribute and typehint it with your desired class:

If the serializer fails to denormalize the input, a HttpBadRequestException will be thrown with a semi-helpful message attached. If you require custom serializer setup, you can register your own instance using the following container key:


All versions of slim-kernel with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-json Version *
slim/slim Version ^4.14
slim/psr7 Version ^1.6
php-di/php-di Version ^7
php-di/slim-bridge Version ^3.4
symfony/console Version ^5.4 | ^6 | ^7
symfony/finder Version ^5.4 | ^6 | ^7
symfony/cache Version ^6 | ^7
symfony/messenger Version ^6 | ^7
symfony/property-access Version ^7.2
symfony/serializer Version ^7.2
phpstan/phpdoc-parser Version ^2.0
phpdocumentor/reflection-docblock Version ^5.6
wondernetwork/php-collection-library Version ^10.0
monolog/monolog Version ^3.10
symfony/event-dispatcher Version ^7.4
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 wondernetwork/slim-kernel contains the following files

Loading the files please wait ...