Download the PHP package omaressaouaf/plain-kit without Composer

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

PlainKit

Latest Stable Version Tests

A small personal PHP toolkit for building MVC-style demos, prototypes, and coding exercises without installing a full framework.

PlainKit gives you just enough structure around routing, middleware, request handling, sessions, CSRF protection, validation, simple views, environment configuration, and a lightweight service container — while staying close to plain PHP.

PlainKit is not a production framework. It is not intended to replace Laravel, Symfony, Slim, or any mature PHP framework. It exists as a practical foundation for personal small projects, experiments, and learning how framework pieces fit together.


Features


Requirements


Installation

Install via Composer:


Quick Start

A PlainKit application needs:

  1. A public entry point (public/index.php)
  2. A routes file (routes.php)
  3. Controllers under app/Http/Controllers/
  4. Views under app/Views/
  5. Optional config, .env, repositories, and services

Entry point

App::create() will:

Routes

Routes map to PHP files at app/Http/Controllers/{path}.php.

Controller

Controllers are plain PHP files. Resolve dependencies from the container with App::resolve():


Project Structure

A typical app built with PlainKit looks like this:

The package lives in vendor/omaressaouaf/plain-kit. Your app root is the directory passed to App::create() — usually one level above public/.


Environment

PlainKit uses vlucas/phpdotenv to load a .env file from the application root.

.env.example:

config/app.php:

Helpers:


Helpers

PlainKit registers these global helpers:

Helper Purpose
base_path('config/app.php') Path relative to the app root
app_path('Http/Controllers/home.php') Path relative to app/
env('KEY', 'default') Read an environment variable
load_env($basePath) Load .env from a directory
e($value) Escape HTML (returns string)
_r($value) Echo escaped HTML
dd(...$values) Dump and die

base_path() requires PLAINKIT_BASE_PATH to be defined (via App::create() or manually).


App & Container

Bootstrapping

Default bindings

These are registered automatically:

Register your own classes with ->bind():

Resolving services

Inside controllers, middleware, forms, repositories, or views:

If a binding is missing, PlainKit throws BindingNotFoundException.


Router

HTTP verbs

Middleware

Attach middleware to the most recently registered route:

Built-in middleware keys:

Key Behavior
auth Redirect to /login if the user is not logged in
guest Redirect to / if the user is already logged in
csrf Verify CSRF token on POST requests (applied automatically on every matched route)

Route parameters

In a controller:

Place static routes before parameterized ones:

Method spoofing

HTML forms can simulate PUT, PATCH, or DELETE via a hidden _method field:

The router reads $_POST['_method'] when handling the request.

404 handling

When no route matches, PlainKit calls Response::abort(404), which loads:


Request


Response

Views receive context variables via extract() and can include partials:

Use e() in views to escape output:


Session

Flash data is cleared automatically at the end of each request via Router::handleRequest().


CSRF

Generate a token in a form:

VerifyCsrf middleware runs on every matched route. On POST requests it checks the submitted _csrf_token. Invalid or missing tokens trigger a 419 response.


Forms & Validation

Creating a form

Extend Form and implement handle():

Validating in a controller

If validation fails, PlainKit throws ValidationException. The router catches it, flashes errors and old input to the session, and redirects back.

Display errors in a view partial:

Validator methods

Method Description
Validator::exists($value) Not empty
Validator::email($value) Valid email
Validator::string($value) Non-empty trimmed string
Validator::numeric($value) Numeric value
Validator::in($value, $array) Value in array
Validator::min($value, $min) Min length/count/numeric
Validator::max($value, $max) Max length/count/numeric

Database

PlainKit includes a thin PDO wrapper. Configuration is read from config/app.php. The connection DSN is currently MySQL-only (mysql:...).

Typical usage in a repository:


Authenticator

Session-based authentication helper:

On successful login, the user record is stored in the session under the user key and the session ID is regenerated.


Middleware

All middleware implements MiddlewareInterface:

Built-in middleware is resolved by key through the Middleware class. To add custom middleware you would extend the middleware map in your own fork or wrapper — PlainKit keeps this intentionally small.


Exceptions

Exception When
BindingNotFoundException Container binding not registered
MiddlewareNotFoundException Unknown middleware key
ValidationException Form validation failed (carries $errors and $old)

Example App

This repository includes a ledger demo at examples/ledger that demonstrates:

Run the example

From the repository root:

See examples/ledger/README.md for more detail.


Testing

Run unit tests:


License

This package is licensed under the MIT License.


All versions of plain-kit with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
vlucas/phpdotenv Version ^5.6
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 omaressaouaf/plain-kit contains the following files

Loading the files please wait ...