Download the PHP package luany/framework without Composer

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

luany/framework

Application framework for Luany. IoC container, HTTP kernel, sessions, validation, config, CSRF, i18n.

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


Table of Contents

  1. Overview
  2. Installation
  3. Application Container
  4. HTTP Kernel
  5. Config
  6. Session
  7. Validation
  8. CSRF Protection
  9. Exception Handling
  10. Helpers
  11. Service Providers
  12. Changelog

1. Overview

luany/framework is the application layer of the Luany ecosystem. It wires together the IoC container, HTTP lifecycle, session management, validation, configuration, and i18n into a coherent application runtime.

It depends on luany/core for routing, request and response primitives, and on luany/lte for the template engine.


2. Installation

The framework is typically used through the application skeleton (luany/luany), which already configures everything correctly.


3. Application Container

The Application class is the IoC container and global registry.

The Application instance is accessible globally via app().

Auto-resolution

Classes with no constructor dependencies are auto-resolved:

Service Provider lifecycle

Path helpers


4. HTTP Kernel

The Kernel orchestrates the full HTTP request lifecycle.

Boot sequence

boot() runs in order:

  1. registerConfig() — loads config/*.php
  2. registerSession() — starts FileSession
  3. registerCsrf() — binds CsrfToken
  4. registerLte() — binds the LTE view engine
  5. loadRoutes() — requires routes/http.php
  6. bootProviders() — calls boot() on all registered providers

Global middleware

Override in your application kernel:

Middleware runs on every request, before routing.


5. Config

Loads PHP files from config/ and provides dot-notation access.

Direct usage:


6. Session

Cookie-based sessions backed by the filesystem (file-per-session in storage/sessions/).

Flash data is available on the next request only:

Old input is automatically available via old() after a failed validate():


7. Validation

Validator directly

validate() helper — recommended

The validate() helper removes all boilerplate from controllers. On failure it automatically flashes errors and old input to the session, then throws a ValidationException which the Kernel resolves as a redirect.

On failure the user is redirected to /users/create with errors and old input in session. The third argument defaults to $_SERVER['HTTP_REFERER'] if omitted.

In the view:

Available rules

Rule Description
required Field must be present and non-empty
string Must be a string
email Must be a valid email address
numeric Must be numeric
min:N Minimum length (string) or value (numeric)
max:N Maximum length (string) or value (numeric)
in:a,b,c Must be one of the listed values
confirmed Must match {field}_confirmation
unique:table,col Must not already exist (requires setUniqueChecker)

unique rule with database


8. CSRF Protection

CsrfToken generates and validates tokens stored in the session.

In LTE templates, use @csrf:

The CsrfMiddleware automatically validates tokens on POST, PUT, PATCH, DELETE requests. It skips validation for GET, HEAD, OPTIONS.


9. Exception Handling

abort()

Abort the current request with an HTTP status code:

Throws HttpException which the Kernel converts to the appropriate response.

Custom handler

Register in a service provider:

Exception priority in Kernel

  1. ValidationException → flash is already done → redirect to $e->getRedirectTo()
  2. HttpExceptionResponse::make($message, $statusCode)
  3. RouteNotFoundExceptionResponse::notFound()
  4. Everything else → custom Handler::render() or Response::serverError()

10. Helpers

All helpers are in src/Support/helpers.php and auto-loaded via Composer.

Helper Description
app(?string $abstract) Resolve from container
env(string $key, mixed $default) Get environment variable
base_path(string $path) Absolute path from app root
view(string $name, array $data) Render a view via LTE
redirect(string $url, int $status) Create redirect Response
response(string $body, int $status) Create Response
config(string $key, mixed $default) Get config value
session(?string $key, mixed $default) Get session or value
csrf_token() Get current CSRF token
old(string $key, mixed $default) Get previous request input
validate(array $data, array $rules, string $back) Validate or throw
abort(int $code, string $message) Abort with HTTP error
__(string $key, array $replace) Translate a key
locale() Get current locale

11. Service Providers

Service providers are the recommended way to register application bindings.

Register in bootstrap/app.php:

Total: OK (174 tests, 223 assertions)

12. Changelog

next/v1 — Phase 6

New:

Modified:

v0.4.0 — Phase 2

IoC container (Application), HTTP Kernel, FileSession, Config, CsrfToken, CsrfMiddleware, Validator (9 rules), Translator, LocaleMiddleware. Full helpers.php: app(), env(), base_path(), view(), redirect(), response(), config(), session(), csrf_token(), old(), __(), locale().


All versions of framework with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
luany/core Version ^1.0
luany/lte Version ^1.0
vlucas/phpdotenv Version ^5.6
psr/log Version ^3.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 luany/framework contains the following files

Loading the files please wait ...