2017 © Pedro Peláez
 

library core

Fwk Core System

image

fwk/core

Fwk Core System

  • Friday, June 3, 2016
  • by neiluJ
  • Repository
  • 0 Watchers
  • 1 Stars
  • 110 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Fwk\Core (Application Framework)

Scrutinizer Code Quality Build Status Code Coverage Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Core is a zero-configuration application framework that makes developers happy :), (*2)

Installation

Via Composer:, (*3)

{
    "require": {
        "fwk/core": "dev-master",
    }
}

If you don't use Composer, you can still download this repository and add it to your include_path PSR-0 compatible, (*4)

Introduction

Core can be used diffently depending on your application needs and how you plan to maintain and make it evolves in time. There is no directory-structure dependencies nor "recommended pattern". Knowing how to configure PHP 5.3+ on your environment is the only prerequisite., (*5)

A Request to an Application calls an Action_ (Controller) which sometimes uses _Services_ (Model) to return a _Result_ (View). Fwk\Core let you use any type of Action thanks to _ActionProxies. An object containing the Request_ (and the _Response) is shared during the runtime, it is the Context. The runtime creates Events emitted by the Application that can be used by Listeners to extends its behavior., (*6)

Included ActionProxies are:, (*7)

  • CallableActionProxy(callable): calls callable
  • ControllerActionProxy(className,methodName): instanciate className and calls methodName
  • IncludeActionProxy(file.php): includes file.php
  • ServiceActionProxy(serviceName): executes the Service registered as serviceName
  • ServiceControllerActionProxy(serviceName, methodName): executes methodName on the Service registered as serviceName

Its suggested to use Fwk\Core\Action\ProxyFactory as a shortcut to the corresponding Fwk\Core\ActionProxy, like:, (*8)

$app->register('Hello', ProxyFactory::factory(function() { /* ... */ })); // CallableActionProxy
$app->register('Hello', ProxyFactory::factory('+file.php')); // IncludeActionProxy
$app->register('Hello', ProxyFactory::factory('HelloWorld\\HelloController:show')); // ControllerActionProxy
$app->register('Hello', ProxyFactory::factory('@service')); // ServiceActionProxy
$app->register('Hello', ProxyFactory::factory('@service:method')); // ServiceControllerActionProxy

Hello World Application

This is probably the simplest example:, (*9)

``` php <?php namespace HelloWorld;, (*10)

// we're index.php in the 'public' http folder (the doc_root) require DIR .'/../vendor/autoload.php';, (*11)

$app = new \Fwk\Core\Application('helloWorld');, (*12)

// the easy way $app['Hello'] = function($name = null) { return 'Hello '. (!empty($name) ? $name : 'World'); };, (*13)

// the above is a shortcut to this: $app->register( 'Hello', new \Fwk\Core\Action\CallableActionProxy( function($name = null) { return 'Hello '. (!empty($name) ? $name : 'World'); } ) );, (*14)

// The is needed to respond to / (or index.php) $app->setDefaultAction('Hello');, (*15)

// execute $response = $app->run(); if ($response instanceof \Symfony\Component\HttpFoundation\Response) { $response->send(); } else { echo $response; } ```, (*16)

That's it! Now open your browser to http://localhost/wherever/index.php or http://localhost/wherever/index.php?name=John+Doe !, (*17)

More documentation on its way..., (*18)

Contributions / Community

  • Issues on Github: https://github.com/fwk/Events/issues
  • Follow Fwk on Twitter: @phpfwk

Fwk is licensed under the 3-clauses BSD license. Please read CREDITS and LICENSE for full details., (*19)

The Versions

03/06 2016

dev-master

9999999-dev

Fwk Core System

  Sources   Download

BSD

The Requires

 

The Development Requires

by Avatar neiluJ

framework core bundle system

03/06 2016

v1.0.1

1.0.1.0

Fwk Core System

  Sources   Download

BSD

The Requires

 

The Development Requires

by Avatar neiluJ

framework core bundle system

03/12 2014

v1.0.0

1.0.0.0

Fwk Core System

  Sources   Download

BSD

The Requires

 

The Development Requires

by Avatar neiluJ

framework core bundle system

12/06 2013

v0.42

0.42.0.0

Fwk Core System

  Sources   Download

BSD

The Requires

 

framework core bundle system