Download the PHP package ginger-tek/routy without Composer

On this page you can find all versions of the php package ginger-tek/routy. 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 routy

Routy

A simple, robust PHP router for fast app and API development

Getting Started

Composer

Starter Example

Handlers for each route can be any kind of callable, such as regular functions, arrow functions, closure variables, or static class methods.

Configurations

You can pass an associative array of optional configurations to the constructor.

Features

Method Wrappers

Use the method wrappers for routing GET, POST, PUT, PATCH, or DELETE method requests. There is also a catch-all wrapper for matching on all standard HTTP methods, including HEAD and OPTIONS.

Use * for the route argument to match on any route.

Custom Routing

You can also use the route() method directly, which is what the common wrappers use underneath, to craft more specific route conditions on which to match.

Dynamic Routes

To define dynamic route parameters, use the :param syntax and access them via the params object on the $app context.

Middleware

Global Middleware

If you want to define global middleware, you can use the use() method. Any middleware or route handler callable must have one argument to accept the current Routy instance.

(See Context Sharing about sharing data between middleware/handlers)

Route Middleware

All arguments set after the URI string argument are considered middleware functions, including the route handler, so you can define as many as needed.

Context Sharing

To share data between handlers/middleware or provide a global resource to the instance, use the setCtx() and getCtx(). Any data type can be passed in for the value.

Route Groups

You can define route groups using the group() method.

You can also add middleware to your nested routes

Fallback Routes

Fallbacks are used for returning custom 404 responses, or to perform other logic before returning.

To set a fallback route, use the notFound() method to set a handler function that will have the HTTP 404 response header already set.

Fallback routes are scoped to wherever they are defined, and will only be reached if they match the incoming URI's parent path.

Serve Static Files (SPA)

To serve static files from a specified directory via a proxy route, use the serveStatic() method after all other normal route definitions. You can use this to serve asset files or a whole SPA directory. If the requested URI is a directory, an index.html file will be served, if one exists. Otherwise, if any requested file is not found, a generic 404 response with be sent back.

NOTE: Serving static files is typically best performed by a web server (Apache/nginx/Caddy) via rewrite rules. Consider your performance requirements in production scenarios when using this feature.

Request Properties

You can access the incoming HTTP method and URI via the uri, method, and params, and query properties on the $app instance.

Request Helper Methods

There are few helper methods for handling incoming request payloads.

getBody()

Use to retrieve the incoming payload data. JSON data will automatically be decoded, and form URL encoded data will be accessible as a standard object.

getHeaders()

Use to retrieve the incoming HTTP headers in an associative array, each header key is auto-lowercased for standardization.

getFiles()

Use to retrieve uploaded files from multipart/form-data requests. Returns an object array for multi-file uploads. To return the first object for single-file uploads, set the second parameter to true.

Response Helper Methods

There are plenty of helper methods for handling responses.

sendJson()

Use to return data as a JSON string

sendData()

Use to return string data or a file's raw contents

redirect()

Use to send a temporary or permanent redirect to a new URL

render()

Use to render a PHP view file, using standard PHP includes and variable scope extraction for MVC modeling

You can set a default layout and/or views directory to use via the constructor config

You can also override the default by settings the layout option to another path

Or you can use no layout by setting the layout option to false

You may also not specify a layout at all, and just render files as is

Finally, set the model option to pass in a data model to expose to the template context in your view files. The current app instance is also exposed to the template context automatically

status()

Use to set the HTTP status code. This can be used for method chaining to other response methods

end()

Use to return immediately with an optional HTTP status code


All versions of routy with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 ginger-tek/routy contains the following files

Loading the files please wait ....