Download the PHP package jyoungblood/stereo-render without Composer
On this page you can find all versions of the php package jyoungblood/stereo-render. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jyoungblood/stereo-render
More information about jyoungblood/stereo-render
Files in jyoungblood/stereo-render
Package stereo-render
Short Description PHP abstraction functions to help more easily render views for Slim Framework. Includes support for JSON, HTML, and Blade.
License MIT
Homepage https://github.com/jyoungblood/stereo-render
Informations about the package stereo-render
STEREO Render
PHP abstraction functions to help more easily render views for Slim Framework (v4) with plain text, HTML, JSON, and Blade (using BladeOne)
These functions aim to provide a simplified and standardized interface for rendering various types of data-driven responses as PSR-7 objects for use with Slim.
Although this package can be used with any Slim4 project, it's specifically designed for use with the STEREO internet toolkit.
Installation
Easy install with composer:
Requirements
- Slim Framework 4
- BladeOne >= 4.13
- PHP >= 7.4
Usage
render::html($request, $response, $string, $status = 200)
Renders a string as HTML. Returns a standard Slim (PSR-7) response object with optional HTTP status code (200 by default).
Additionally, a path to an HTML file (relative to the public
web root) can be specified to load and render instead of a string:
render::text($request, $response, $string, $status = 200)
Renders a string as plain text. Returns a standard Slim (PSR-7) response object with optional HTTP status code (200 by default).
render::redirect($request, $response, $string, $status = 302)
Renders a redirect as standard Slim (PSR-7) response object with optional HTTP status code.
render::json($request, $response, $data, $status = 200)
Renders an array or data as standard Slim (PSR-7) response object with application/json
content type and optional HTTP status code.
render::blade($request, $response, $parameters, $status = 200)
Renders a specific Blade template with an array of data. Returns a standard Slim (PSR-7) response object with optional HTTP status code (200 by default).
The Blade compiler expects views and cache files to be directories called views
and cache
, respectively, in the public
web root. These defaults, along with the compilation mode, can be customized in your .env
file:
The compilation mode can be set to AUTO
(default), SLOW
, FAST
, or DEBUG
, see the BladeOne source for more information.
Check out the BladeOne and official Blade documentation to see everything you can do with this incredible templating syntax.
The BladeOne HTML Extension is also included for conveniently creating form components with near-native performance.
render::blade_template($parameters)
Renders a specicific Blade template with data array the same as render::blade()
, but returns raw html instead of a PSR-7 response.