2017 © Pedro Peláez
 

library framework

Tekton is a lightweight PHP framework, designed to integrate well with existing Laravel Illuminate components.

image

tekton/framework

Tekton is a lightweight PHP framework, designed to integrate well with existing Laravel Illuminate components.

  • Tuesday, June 19, 2018
  • by nsrosenqvist
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Tekton Framework

Tekton is a lightweight PHP micro-framework, designed to integrate as a shim in older codebases to enable modern design patterns. tekton/framework is the core of sub-frameworks that provides config loading, DI container, environment loading, service providers, facades and class aliases., (*1)

The reason it was created was to allow integrating the power and ease of use of modern design patterns when working in more limited environments. A good example is the Dynamis project that does exactly that by enabling this within a WordPress environment., (*2)

Installation

composer require tekton/framework

Usage

To get started, just require the project in your composer configuration, provide a PSR-11 container and initialize the framework., (*3)

require_once 'vendor/autoload.php';

use Tekton\Framework;
use DI\Container;

$framework = Framework::getInstance();
$framework->setContainer(new Container)
          ->setEnvironment('development')
          ->setResourceCaching(true)
          ->setCacheDir(__DIR__.'/cache')
          ->registerConfig(__DIR__.'/config');
          ->setFacadeAliases('Project\\Facades', __DIR__.'/Facades')
          ->registerAlias('ProjectClass', 'Project\\Class');

$framework->registerProvider([
    \Project\Providers\ServiceOne::class,
    \Project\Providers\ServiceTwo::class,
    \Project\Providers\ServiceThree::class,
]);

$framework->init(__DIR__, 'http://localhost:8000/');

There are several helper functions to quickly retrieve config values, services or resource URIs. You can also initialize the framework in steps if you need to retrieve config values before registering providers or aliases., (*4)

$framework = Framework::getInstance();
$framework->setContainer(new Container)
          ->registerConfig(__DIR__.'/config')
          ->loadEnv()
          ->loadConfig();

$framework->registerProvider(app('config')->get('app.providers'));
$framework->registerAlias(app('config')->get('app.aliases'));

$framework->init(__DIR__, 'http://localhost:8000/');

License

MIT, (*5)

The Versions