Download the PHP package danack/slim4-auryn-invoker without Composer

On this page you can find all versions of the php package danack/slim4-auryn-invoker. 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 slim4-auryn-invoker

Slim Auryn Invoker

Build Status

This library allows you to use the Auryn Dependency Injection library as the dispatching layer of a Slim Framework application.

It replaces the built-in dispatcher that executes the callables for routes, and instead executes the callables through Auryn.

It does not affect the dispatching of middlewares.

Quickstart

If you install this library though Composer, all you need to do to link it into a Slim application is to set the 'foundHandler' when creating the Slim app.

There is an example app in the example directory

Why you should use this library

There are two main reasons to use Auryn as the tool that executes your controllers in your application; it allows you to use interface segregation for passing in parameters, as well allowing your controllers to return simple 'stub response' types, rather than having to touch the PSR 7 response object.

Inteface segregation for parameters

@todo - explain why interface segration is so awesome for controllers.

I have a talk that I have given at a couple of user groups and PHPNW - https://www.youtube.com/watch?v=YKXfOYTBaI4 for which the slides are available here.

Simple typed return values

I pretty strongly believe that most of the time, it should be left to the framework to connect up a 'stub response' from a controller to the underlying library that will be used to actually send it to a user.

The SlimAurynInvoker allows you to return a 'stub response' object that consists of just the status code, body and a set of headers that the controller wishes to send as the response. The library

This makes life much more pleasant. Compare two equivalent controllers. The first controller directly modifies the Response object.

The second controller simply returns a stub JsonResponse.

By returning a stub response object, it not only remove a lot of tedious, fiddly code from your controllers, but also makes it easier to:

Setup and result processing

The steps before and after the controller is dispatched can be controlled by the user. By default the steps are defined as follows:

Setting up before the controller is dispatched

By default the SlimAurynInvoker does these actions.

Result processing

By default after dispatching the controller, the SlimAurynInvoker will:

Customising the setup and result processing

If you want to customise either the setup or result processing functionality, you can do that by passing appropriate callables as the $resultMappers and/or $setupFunction into the \Danack\SlimAurynInvoker\SlimAurynInvokerFactory.

The resultMapper array should be an array, where the keys are the types that are returned by the controller, and the values are callables, with the signature:

A setup callable should have this signature:

An example that show an alternative resultMapper is in the file ./example/public/index_html.php. It shows how you can configure the SlimAurynInvoker, so that each controller can just return a string, which automatically gets sent as a HTML response.

Running the example

There is a simple example app in the example folder, which can be run by using PHP's built-in webserver. You can run it by running this:

in the root directory of this library, and then going to http://127.0.0.1:8000/ in your browser.

Additionally, there is an example of a controller returning just a string, which is mapped into a HTML response at http://127.0.0.1:8000/index_html.php

Notes

How to run the unit tests

php vendor/bin/phpunit -c test/phpunit.xml

How to run the code style check

php vendor/bin/phpcs --standard=./test/codesniffer.xml --encoding=utf-8 --extensions=php -p -s lib


All versions of slim4-auryn-invoker with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.0
rdlowrey/auryn Version ^1.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 danack/slim4-auryn-invoker contains the following files

Loading the files please wait ....