Download the PHP package qiq/helper-sapien without Composer

On this page you can find all versions of the php package qiq/helper-sapien. 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 helper-sapien

Qiq Helpers for Sapien

This package provides Qiq helpers for Sapien Request and Response objects. These helpers allow you to read from a Request, and build a Response, from inside a Qiq Template.

Read more about:

Installation

This package is installable via Composer as qiq/helpers-sapien:

Request Helper

Registration

To make the request helper available inside your Template, you need to register it with the Qiq HelperLocator. You can register the helper semi-automatically ...

... or you can do so more manually:

By default, the helper will construct a new internal Sapien Request object of its own. If you want to pass an existing Request object, you may do so:

Usage

Once the helper is registered, you can call it using the method name you registered it under. You can use Qiq syntax ...

... or PHP syntax:

The request helper proxies to its internal Sapien Request object, making all of the Request properties available.

To replace the proxied Request object, use the set() method:

To get the proxied Request object directly, use the get() method:

Response Helper

Registration

To make the response helper available inside your Template, you need to register it with the Qiq HelperLocator. You can register the helper semi-automatically ...

... or you can do so more manually:

By default, the helper will construct a new internal Sapien Response object of its own. If you want to pass an existing Response object, you may do so:

Usage

Once the helper is registered, you can call it using the method name you registered it under. You can use Qiq syntax ...

... or PHP syntax:

The response helper proxies to its internal Sapien Repsonse object, making all of the Response methods available.

To replace the proxied Response object, use the set() method:

To get the proxied Response object directly, use the get() method:

Rendering

With typical Template usage, the code calling a Template will set the rendered template results into a Response body ...

... as well as setting version, status, headers, and cookies on the Response.

With this helper, you instead call render() on the helper itself, passing it the Template object to be used for content, and get back a Response object.

The returned Response will be the one built up inside the template, complete with the version, status, headers, and cookies that were set in the template code.

Content Replacement

When you call response()->render(), the Response content will be whatever was rendered from a normal Template invocation.

However, you can override this behavior by calling response()->setContent(...) and setting the content directly from inside the template code. In the following example, the Response content will be "Hello, world!":

Specialized Responses

While you can replace the internal Response using response()->set(...) and exert fine control over the replacement Response, the helper provides two convenience methods to replace the Response with specialized Sapien responses: one for FileResponse and one for JsonResponse.

To convert the Response to a FileResponse, call response()->setFile():

The setFile() method mimics the identically-named method in FileResponse.

To convert the Response to a JsonResponse, call response()->setJson(). The following example puts all the current Template data into a JsonResponse:

The setJson() method mimics the identically-named method in JsonResponse.

Note that these methods will override any output that would normally be rendered by the template code, replacing that output with the file output or JSON output, respectively.


All versions of helper-sapien with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
qiq/qiq Version ^2.0
sapien/sapien Version ^1.0
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 qiq/helper-sapien contains the following files

Loading the files please wait ....