Download the PHP package luany/core without Composer

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

luany/core

HTTP Request/Response, Router, Middleware Pipeline, CORS, Rate Limiting, and Route Caching for the Luany ecosystem.

Version: v1.0.0  |  PHP: >= 8.2  |  License: MIT Author: António Ambrósio Ngola  |  Org: luany-ecosystem


Table of Contents

  1. Installation
  2. Request
  3. Response
  4. Router & Route Facade
  5. Middleware
  6. Rate Limiters
  7. Exceptions
  8. Changelog

1. Installation


2. Request

Class: Luany\Core\Http\Request

Method override: HTML forms may include a hidden _method field (PUT, PATCH, DELETE). fromGlobals() handles this automatically.

JSON body: If Content-Type: application/json, the body is parsed from php://input automatically.

Body-only helper: Request::body() returns only parsed body fields (POST/JSON), unlike all() which merges body + query.


3. Response

Class: Luany\Core\Http\Response


4. Router & Route Facade

Classes: Luany\Core\Routing\Router, Luany\Core\Routing\Route

Route is a static facade over the singleton Router instance.

Basic Registration

Controllers may return Response, string, or array (auto-JSON).

Route Parameters

Named Routes

Route Groups

Resource Routes

View Routes

Model Binding

Automatically resolve route parameters to model instances before the action is called.

Unbound parameters pass through as raw strings. Bindings match by parameter name.

Route Caching

Serializes the compiled route table to a PHP file. Only array-action routes ([Controller::class, 'method']) are cached — closure routes cannot be serialized.


5. Middleware

Pipeline

Implementing middleware:

CorsMiddleware

Behaviour: OPTIONS requests short-circuit with 204. Wildcard ['*'] + credentials echoes the actual Origin. Disallowed origins get no CORS headers. Subdomain wildcards (*.example.com) are supported.

RateLimitMiddleware

Exceeding the limit returns 429 with X-RateLimit-Limit, X-RateLimit-Remaining: 0, and Retry-After headers. Allowed requests receive X-RateLimit-Limit and X-RateLimit-Remaining.

Override keyFor(Request $request): string to key by user ID instead of IP.


6. Rate Limiters

InMemoryRateLimiter

Per-process static store. For tests and development only.

FileRateLimiter

JSON file-backed store. Safe for single-server production. Uses flock() for concurrency safety. Keys are SHA-256 hashed — no path traversal possible.

Custom RateLimiter

Implement Luany\Core\RateLimit\RateLimiterInterface:


7. Exceptions

Exception Code When thrown
RouteNotFoundException 404 No route URI matches the request
MethodNotAllowedException 405 URI matches a route but the HTTP method does not

MethodNotAllowedException::getAllowedMethods(): string[] — e.g. ['GET', 'POST'] MethodNotAllowedException::getAllowHeaderValue(): string — e.g. 'GET, POST'


8. Changelog

v1.0.0 — Phase 4: Core Hardening

New — src/Routing/RouteCache.php

Modified — src/Routing/Router.php

Modified — src/Routing/Route.php

Existing (shipped before Phase 4, now fully tested): MethodNotAllowedException, CorsMiddleware, RateLimitMiddleware, RateLimiterInterface, InMemoryRateLimiter, FileRateLimiter

Tests added: MethodNotAllowedTest (12), CorsMiddlewareTest (16), RateLimiterTest (15), FileRateLimiterTest (14), RateLimitMiddlewareTest (9), RouteCacheTest (15), RouteModelBindingTest (10)

Total: OK (180 tests, 261 assertions)


v0.2.4 and earlier

HTTP Request/Response, Router with groups and named routes, resource/apiResource, Pipeline, RouteRegistrar, RouteGroup, method override, $_GET isolation.


All versions of core with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
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 luany/core contains the following files

Loading the files please wait ...