Download the PHP package tobento/app-http without Composer

On this page you can find all versions of the php package tobento/app-http. 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 app-http

App Http

Http, routing, middleware and session support for the app.

Table of Contents

Getting Started

Add the latest version of the app http project running this command.

Requirements

Documentation

App

Check out the App Skeleton if you are using the skeleton.

You may also check out the App to learn more about the app in general.

Http Boot

The http boot does the following:

Http Config

Check out to change needed values.

Request And Response

You may access the PSR-7 and PSR-17 interfaces by the app:

Check out the Uri Service to learn more about the base and current uri.

Http Functions

The following Http functions are available:

Swap PSR-7 And PSR-17 Implementation

You might swap the PSR-7 and PSR-17 implementation to any alternative.\ Check out the App - Customization to learn more about it.

Requester And Responser Boot

The requester and responser boot does the following:

Check out the Requester Service to learn more about it.

Check out the Responser Service to learn more about it.

Responser Messages

Messages will be translated if you have installed the App Message - Translating Messages.

Added Middleware

Class Description
Tobento\Service\Responser\Middleware\Responser::class Adds the responser to the request attributes.
Tobento\Service\Responser\Middleware\ResponserMergeInput::class Merges the responser input with the request input.

Middleware Boot

The middleware boot does the following:

Check out the Middleware Service to learn more about the middleware implementation.

Add Middleware via Config

You can configure middleware in the config file which are applied to all routes and requests:

Add Middleware via Boot

You might create a boot for adding middleware:

Middleware Aliases

Add Aliases via Config

You can configure middleware aliases in the config file :

Middleware Groups

Add Groups via Config

You can configure middleware groups in the config file :

Available Middleware

Previous Uri Session Middleware

The middleware is automatically added by the Session Boot which stores the uri history in the session.

Get Previous Uri

Exclude From Previous Uri History

You may exclude a certain uri from the history by adding a header on the response:

Secure Policy Headers Middleware

This middleware will add the following secure policy headers to the response:

In the file:

Using inline scripts and styles

The middleware will add a header with a nonce for and . Therefore, to allow inline scripts or styles you must add the nonce to the html:

If using the App View bundle, you can retrieve the nonce from the view:

Routing Boot

The routing boot does the following:

Check out the Routing Service to learn more about the routing.

Routing via Boot

You might create a boot for defining routes:

Then adding your routes boot on the app:

Domain Routing

You may specify the domains for routing in the file.

Check out the Routing Service - Domain Routing section to learn more about domain routing.

Route Handler

You may add route handlers to interact with the route handling.

Here is some benefits of adding handlers:

First, create a route handler:

Finally, add the route handler:

The only handler added is the with a priority of .

Route List Command

If you have installed the App Console you may run the route:list command providing an overview of all the routes that are defined by your application:

Displays only specific routes by its name with additional information:

Session Boot

The session boot does the following:

Check out the Session Service to learn more about the session in general.

Session Config

Check out to change needed values.

Session Lifecycle

The session gets started and saved by the session middleware whereby interacting with session data is available after.

Session Error Handling

You may add an error handler for handling exceptions caused by the session middleware.

You may handle these exceptions with the Error Handler - Handle Other Exceptions instead.

Check out the Throwable Handlers to learn more about handlers in general.

Cookies Boot

The cookies boot does the following:

Check out the Cookie Service to learn more it.

Cookies Config

Check out to change needed values.

Cookies Usage

Read and write cookies

Check out the Cookie Values to learn more it.

Check out the Cookies to learn more it.

Cookies Encryption

First install the app-encryption bundle:

Then, just boot the if you want to encrypt and decrypt all cookies values. That's all.

Whitelist cookie

To whitelist a cookie (disable encryption), use the after the booting:

Configuration

The encrypting and decrypting is done with the implemented processed by the specified middleware in the file.

You may check out the App Encryption to learn more about it.

Error Handler Boot

By default, the error handler will render exceptions in json or plain text format. If you want to render exception views to support html and xml formats check out the Render Exception Views section.

It handles the following exceptions as well as the Http Exceptions:

As Code Exception
404
403
403
403
500 Any other not handled before

Http Exceptions

There are several HTTP exceptions you can throw from your controllers and middleware, which are handled by the default error handler:

As Code Exception
any
400
401
403
404
429

Example:

Render Exception Views

In order to render exceptions in html or xml format, the must be available within the app. You might install the App View bundle or just implement the :

It renders the following view if exist:

View Description
Any specific error with the named code.
Any specific error with the named code in xml format.
If specific does not exist.
If specific does not exist in xml format.

Handle Other Exceptions

You might handle other exceptions by just exending the error handler:

Messages will be translated if you have installed the App Translation using uses the as resource name. Check out the Translation Resources and Translation Files Resources to learn more about it.

And boot your custom error handler instead of the default:

Prioritize Error Handler

You may create an error handler and use the constant to define a priority.

The default priority is , higher gets handled first.

And boot your error handler:

Credits


All versions of app-http with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
psr/container Version ^2.0
psr/http-message Version ^1.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
psr/http-factory Version ^1.0
nyholm/psr7 Version ^1.4
nyholm/psr7-server Version ^1.0
laminas/laminas-httphandlerrunner Version ^1.4
tobento/app Version ^1.0
tobento/app-migration Version ^1.0
tobento/service-middleware Version ^1.0.2
tobento/service-routing Version ^1.0.5
tobento/service-session Version ^1.0.1
tobento/service-cookie Version ^1.0.1
tobento/service-requester Version ^1.0.2
tobento/service-responser Version ^1.0
tobento/service-uri Version ^1.0.1
tobento/service-config Version ^1.0.3
tobento/service-migration Version ^1.0
tobento/service-error-handler Version ^1.0
tobento/service-translation Version ^1.0.3
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 tobento/app-http contains the following files

Loading the files please wait ....