PHPackages                             neoform/neoform - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. neoform/neoform

ActiveLibrary[Framework](/categories/framework)

neoform/neoform
===============

PHP MVC Toolbox

381[4 issues](https://github.com/neoform/PHP-Neoform/issues)PHP

Since Mar 27Pushed 7y ago2 watchersCompare

[ Source](https://github.com/neoform/PHP-Neoform)[ Packagist](https://packagist.org/packages/neoform/neoform)[ RSS](/packages/neoform-neoform/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Neoform
===========

[](#php-neoform)

This is a toolbox I've developed over the years that has been used for many websites I've built. The primary mission I had when creating this library was to make the code fast and east to use. The main features of this toolbox:

- **MVC and Bootstrapping**:
    - `Request\Request` (immutable object composed of the HTTP request data)
    - Routed via a `Router\Routes` map (cached for performance)
    - `Neoform\Router\Controller` then generates a `Render\View` object (eg, HTML, JSON, or Raw)
    - `Response\Response` object is passed the rendered View
    - Bootstrap decides what to do with the Response, usually echoing it
- **Service provider** tools via `Service\Service`, allowing for resource based objects to only be activated when needed. This helps greatly when doing dependency injection whilst avoiding unnecessary resource allocation (eg, opening a MySQL or Redis connection).
- **Session** handling via `Session\Auth` that connects with a powerful ACL (`Acl`) that allows for user control via roles and groups.
- **Entity** mapping from a data source automatically gets cached at the record level. Multiple different types of cache can be employed. Unlike most entity caching systems, this one can use Memcache/Redis (or others) and will **never** serve stale cache.
    - Loading a `Entity\Model` is as easy as: `Neoform\User\Model::fromPk(591);`. If the record does not exist in cache, it will be fetched and saved to cache for every subsequent lookup.
    - Loading an `Entity\Collection` has the same feature set: `Neoform\User\Collection::byStatus(2);`. The result will be cached, and the cache will be deleted as soon as any Model in the Collection has changed.
- **Configs** that are object based located in an `Config\Environment` file, which is subsequently cached for performance. Instead of just dumping a bunch of random array values into a big messy config file, configs are validated twice before being compiled/cached. This means you can always trust the values found in the config file, even if it's been inherited multiple times.
    - Sad Face: `echo isset($config['core']['site_name']) ? $config['core']['site_name'] : 'Oops';`
    - Happy Face: `echo Neoform\Core\Config::get()->getSiteName();`.
- **Input Validation** is done via an extremely flexible Model/Collection design pattern that allows for `Input\Validation` objects to be created for various scenarios, and applied to the `Input\Collection`. If any value has an error, or is absent whilst listed as required, an `Input\Error\Collection` will be made available.
- **Auto-Generation** of `Entity` classes based on MySQL/PostgreSQL table mappings. Tables, Fields, Indexes and Foreign keys are used to map out the relationships between `Entity` objects. Subdivided into two main groups (`Entity\Records` and `Entity\Links`) you can interact with the Entities in a very natural way, and the code is all generated for you with a simple CLI script.

Composer Install
----------------

[](#composer-install)

If you wish you can install PHP Neoform via [Composer](http://getcomposer.org).

Add `neoform/neoform` as a dependency in your project's `composer.json` file:

```
{
    "require": {
        "neoform/neoform": "dev-master"
    }
}
```

Examples
--------

[](#examples)

### Sample Index:

[](#sample-index)

```
