PHPackages                             minphp/bridge - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. minphp/bridge

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

minphp/bridge
=============

Bridges minPHP 0.x to minPHP 1.x

3.3.1(11mo ago)0922↓50%2[1 PRs](https://github.com/phillipsdata/minphp-bridge/pulls)MITPHPPHP &gt;=5.4.0CI failing

Since Jun 7Pushed 11mo ago4 watchersCompare

[ Source](https://github.com/phillipsdata/minphp-bridge)[ Packagist](https://packagist.org/packages/minphp/bridge)[ Docs](http://github.com/phillipsdata/minphp-bridge)[ RSS](/packages/minphp-bridge/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (17)Versions (52)Used By (0)

Minphp/Bridge
=============

[](#minphpbridge)

This library allows you to seamlessly take advantage of newer namespaced minPHP libraries while at the same time maintaining backwards compatibility with minPHP 0.x global classes.

**Why use this library**

This library is intended for projects that are built using minPHP 0.x that want to take advantage of other namespaced minPHP libraries.

Installation
------------

[](#installation)

Install via composer:

```
composer require minphp/bridge
```

Usage
-----

[](#usage)

The bridge requires some information before it's able to initialize some libraries. This is handled by populating and passing in a container that implements `Minphp\Container\ContainerInterface`.

The following config files in minphp 0.x were removed in minphp 1.0, which is what necessitates populating the container:

- core.php
- database.php
- session.php

minPHP uses the `Minphp\Container\Container`, which meets this requirement. The following elements are required to be set:

- `minphp.cache` *array* containing:
    - `dir` *string*
    - `dir_permission` *int* (octal)
    - `extension` *string*
    - `enabled` *bool*
- `minphp.config` *array* containing:
    - `dir` *string*
- `minphp.constants` *array* containing:
    - `APPDIR` *string*
    - `CACHEDIR` *string*
    - `COMPONENTDIR` *string*
    - `CONFIGDIR` *string*
    - `CONTROLLERDIR` *string*
    - `DS` *string*
    - `HELPERDIR` *string*
    - `HTACCESS` *bool*
    - `LANGDIR` *string*
    - `LIBDIR` *string*
    - `MINPHP_VERSION` *string*
    - `MODELDIR` *string*
    - `PLUGINDIR` *string*
    - `ROOTWEBDIR` *string*
    - `VENDORDIR` *string*
    - `VIEWDIR` *string*
    - `WEBDIR` *string*
- `minphp.language` *array* containing:
    - `default` *string* 'en\_us'
    - `dir` *string*
    - `pass_through` *bool*
- `minphp.mvc` *array* containing the following keys:
    - `default_controller` *string*
    - `default_structure` *string*
    - `default_view` *string*
    - `error_view` *string*
    - `view_extension` *string*
    - `cli_render_views` *bool*
    - `404_forwarding` \* bool\*
- `minphp.session` *array* containing the following keys (all optional):
    - `db` *array* containing:
        - `tbl` *string* The session database table
        - `tbl_id` *string* The ID database field
        - `tbl_exp` *string* The expiration database field
        - `tbl_val` *string* The value database field
        - `ttl` *int* The session time-to-live, in seconds, relative to current server time (should be set to the same value as the other TTLs, e.g., 'max(ttl, cookie\_ttl)' to correctly sync client and server session expirations)
    - `ttl` *int* Number of seconds to keep a session alive.
    - `cookie_ttl` *int* Number of seconds to keep long storage cookie alive.
    - `session_name` *string* Name of the session.
    - `session_httponly` *bool* True to enable HTTP only session cookies.
- `cache` *Minphp\\Cache\\Cache*
- `view` *View* As a factory (new instance each time)
- `loader` *Loader*
- `pdo` *PDO*

### Creating and Using the Container

[](#creating-and-using-the-container)

First create a new config file called `services.php` that will be used to define our service providers.

Each service is defined as the fully qualified class name. It can be whatever you want as long as it can be properly autoloaded.

**/config/services.php**

```
