Download the PHP package sethrensei/ren-router without Composer

On this page you can find all versions of the php package sethrensei/ren-router. 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 ren-router

RenRouter

RenRouter is a modern, lightweight and secure PHP micro-router — designed to be the routing core of a custom framework or as a standalone HTTP layer for projects that don't need a full framework.

It provides clean HTTP orchestration (routing, dispatching, views, error handling), declarative security (authentication and roles), pluggable template engines (PHP or Twig), and URL extension spoofing for stack obfuscation.


✨ Key Features


🧱 Architecture


🚀 Quick Start

1. Install

2. Bootstrap (PHP templates)

3. Bootstrap (Twig)


🔀 Route Registration

Method Signature Use case
get() get(uri, target, name, options) Single GET route
post() post(uri, target, name, options) Single POST route
route() route(uri, target, method, name, options) Any method or GET\|POST

Targets can be:

AltoRouter patterns are supported in URIs:


🔐 Security & Authorization

Security is declared at route level, not inside controllers.

Option Type Behaviour
auth bool Redirects to the security route if not authenticated
roles string\|string[] Throws 403 if no matching role is found

Automatically thrown exceptions:

Situation Exception HTTP Code
Not authenticated UnauthorizedHttpException 401
Wrong role ForbiddenHttpException 403
No matching route NotFoundHttpException 404
Any other error HttpException / caught Throwable 500

Auth helper


🎮 Controllers

Extend AbstractController for instant access to all response helpers.

AbstractController API

Category Method Description
Guards requireAuth(?Router) Redirect to login if not authenticated
requireRole(roles, ?Router) Requires auth + matching role
denyUnless(bool, message) Throws 403 when condition is false
notFound(message): never Throws 404 immediately
Rendering render(view, data, ?Router) Renders via the template engine
renderPartial(view, data, ?Router): string Returns rendered HTML as string
Redirects redirectToRoute(name, params, status, ?Router) Named route redirect
redirect(url, status, ?Router) Raw URL redirect
JSON json(data, status): never JSON response + exit
jsonError(message, status, extra): never {error, message, code} + exit
Flash flash(type, message) Write flash to session
flashSuccess(message) Shorthand for type success
flashError(message) Shorthand for type error
getFlash(type): array Read + clear one type
getAllFlash(): array Read + clear all types
Request input(key, default, from) Read from POST/GET/both
postData(only): array All POST, optionally filtered
isMethod(method): bool Check HTTP method
isAjax(): bool XHR / JSON Accept detection

🌐 Twig Integration

TwigEngine mirrors Symfony's Twig integration exactly.

These functions are available in every template automatically:

Twig function PHP equivalent Example output
path('route', {id:1}) Router::path() /contact.html
url('route', {id:1}) Router::url() https://example.com/contact.html
asset('css/app.css') Router::asset() https://example.com/css/app.css
route_exists('name') Router::hasRoute() true / false

For custom extensions and globals:


🎭 URL Extension Spoofing

Confuse security scanners and bots by exposing a fake tech stack:

Generated URLs follow the same rule:

The extension is stripped from incoming requests before matching — your route definitions never need to change.


❗ Error Handling

Errors are caught centrally by the router. In production, dedicated view files are rendered:

The $exception and $code variables are available inside error views.

In development (APP_ENV=DEV), the raw exception message and stack trace are printed as plain text.

You can also map error codes to named routes:


🔗 URL Generation


📦 Requirements

PHP ≥ 8.1
AltoRouter composer require altorouter/altorouter
Twig composer require twig/twig
Symfony Dotenv composer require symfony/dotenv
HTMLPurifier composer require ezyang/htmlpurifier"
PSR-3 logger, HTTP message and factory any PSR-3 compatible package

🎯 Philosophy

RenRouter is built around three principles:

It is not a framework. It is a reliable foundation to build one.


📄 License

MIT — free to use, modify and distribute.


All versions of ren-router with dependencies

PHP Build Version
Package Version
Requires altorouter/altorouter Version ^2.0
psr/log Version ^3.0
psr/http-message Version ^2.0
psr/http-factory Version ^1.1
symfony/dotenv Version ^7.4
ezyang/htmlpurifier Version ^4.19
twig/twig Version ^3.27
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 sethrensei/ren-router contains the following files

Loading the files please wait ...