2017 © Pedro Peláez
 

library flat

experimental framework for php

image

katmore/flat

experimental framework for php

  • Tuesday, May 22, 2018
  • by acksponies
  • Repository
  • 2 Watchers
  • 0 Stars
  • 260 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 38 Versions
  • 5 % Grown

The README.md

The Flat Framework

An experimental framework for php, (*1)

It was created to allow a project to be organized in a hierarchical manner similar to a REST service., (*2)

Architecturally, it facilitates a broad swathe of design patterns using a client-server process flow., (*3)

Features

  • HTML templating: convenience classes facilitating sophisticated templating
  • Front-End Routing: flexible dynamic routing for the HTML views
  • Back-End Webservice: convienence classes to faciliate actual RESTful APIs
  • Command line scripts: convenience classes to faciliate creation of recurring (cron), deamons, and ad-hoc scripts

Installation

The Flat Framework can be the basis of a new project or added to an existing project, (*4)

New Projects

The easiest way to get going with The Flat Framework is to copy the flat boilerplate webapp., (*5)

Step 1. Composer 'create-project' (flat boilerplate webapp)..., (*6)

composer create-project katmore/flat-webapp my_project_dir

(copies this repo and configures php dependencies), (*7)

Step 2. Bower update, (*8)

cd my_project_dir
bower update

(installs static dependencies), (*9)

Existing Projects

Step 1. Using composer, (*10)

cd my_project_dir
composer require katmore/flat

Step 2. Bower update, (*11)

cd my_project_dir
bower update

Architecture

The components of flat architecture facilitate a client-server process flow..., (*12)

  • resources: An abstract hierarchical tree of the applications components.
  • app objects: A group of instantiable php objects.
  • app routes: A group of of routes that an application controller can access to resolve a client request.
  • app controllers: A group of application "entry-points"; i.e. the "server" which processes a request from the "client".
  • requests: A request consists of a client inquiry which provides a resource and any associated input data to an app controller.
  • route maps: A route map consists of multiple routes that each must be resolved by an app controller
  • resolvers: A resolver instantiates app objects when given a resource.

Admittedly, the component organization of the flat architecture is rigidly attached to the client-server model. Despite this, the programming design constraints of a flat based project are actually very minimal. For this reason, flat can be argued to be a lightweight framework. Any programming design pattern can be used within a flat project., (*13)

However... there is an idealized programming design use case neatly bundled within the architecture., (*14)

Groan...yes, it is yet another design pattern., (*15)

The Resource-Route-Controller is a novel design pattern invented in tandem with flat. It is, though, intended to be a very lightweight design pattern that should not keep other design patterns (MVC, MVP, MVVM) from being incorporated. It is described further in a section below., (*16)

The hierarchical organization of a flat project is abstracted into multiple abstract levels of programming design (not just the path names of scripts and dependency file structure)., (*17)

The following sections contain further details regarding concepts and terminology encountered in flat., (*18)

Resource:

A "resource" is a string value comprised of one or more "segments", each "segment" being delineated by either a backslash "\" or forward-slash "/"., (*19)

For example, given the following URL:, (*20)

https:/example.com/my_app/my_app_frontend/my_frontend_view

An app controller might extract the URL path as the resource /my_app/my_app_frontend/my_frontend_view and then check if a php class exists with the name \my_app\my_app_frontend\my_frontend_view, and instantiate the class, which becomes an app object..., (*21)

$check_class = $_SERVER ['PATH_INFO'];
$check_class = str_replace('/','\\',$check_class);
if (class_exists($check_class)) {
   new $check_class;
}

Note: flat has convenience classes that facilitate more complex routing than the trivial example above. These facilitate more complex aspects, such as dealing with associated request input data., (*22)

See * Route Rules definition below * Route Factory definition below * Resolver Class https://github.com/katmore/flat/blob/master/src/flat/core/resolver.php, (*23)

Route Factory:

A "route factory" facilitates creating a "route map" for resolving a "resource"., (*24)

Route Map:

A "route map" consists of "route rules" which determine how a "resource" corresponds to php classnames within a php sub-namespace., (*25)

Entry Point Controller:

An entry-point controller script uses a "resolver" to instantiate "app objects". based on the "route map" logic created in this, (*26)

An example of an entry-point script can be seen in the 'flat-webapp' github repo: https://github.com/katmore/flat-webapp/blob/master/web/api.php, (*27)

The "Resource-Route-Controller" Design Pattern

  • resource
    • input data associated
  • controller
    • request Determines the resource (and any input) to provide the controller

"Resource-Route-Controller"

Ideal process flow incorporating Resource-Route-Controller design using 'client-server' model 1. An application controller is provided a "resource" along with any "input" 2. A controller "resolves" the "resource" into one or more objects which contain the application logic., (*28)

Copyright (c) 2012-2019 Doug Bird - retran@gmail.com. All Rights Reserved., (*29)

This software is distributed under the terms of the MIT license or the GNU General Public License v3.0., (*30)

The Versions

22/05 2018

dev-master

9999999-dev https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+ GPL-3.0-or-later

The Requires

 

22/05 2018

v1.3.6

1.3.6.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0-or-later

The Requires

 

15/03 2018

v1.3.5

1.3.5.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0-or-later

The Requires

 

30/01 2018

v1.3.4

1.3.4.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0-or-later

The Requires

 

26/01 2018

v1.3.3

1.3.3.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0-or-later

The Requires

 

18/01 2018

v1.3.1

1.3.1.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0-or-later

The Requires

 

18/01 2018

v1.3.0

1.3.0.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0-or-later

The Requires

 

18/01 2018

v1.2.9

1.2.9.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0

The Requires

 

18/01 2018

v1.2.8

1.2.8.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

19/12 2017

v1.2.7

1.2.7.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

13/12 2017

v1.2.6

1.2.6.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

17/10 2017

v1.2.5

1.2.5.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

06/10 2017

v1.2.4

1.2.4.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

06/10 2017

v1.2.3

1.2.3.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

05/10 2017

v1.2.2

1.2.2.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

22/09 2017

v1.2.1

1.2.1.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

22/09 2017

v1.1.10

1.1.10.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

22/09 2017

v1.2.0

1.2.0.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

07/06 2017

v1.1.9

1.1.9.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

07/06 2017

v1.1.8

1.1.8.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

03/06 2017

v1.1.7

1.1.7.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

19/04 2017

dev-devel

dev-devel https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

19/04 2017

v1.1.6

1.1.6.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

12/04 2017

v1.1.5

1.1.5.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

04/04 2017

v1.1.4

1.1.4.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

25/03 2017

v1.1.3

1.1.3.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

24/03 2017

v1.1.2

1.1.2.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

24/03 2017

v1.1.1

1.1.1.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

20/03 2017

v1.1.0

1.1.0.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

18/03 2017

1.0.11

1.0.11.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

09/03 2017

1.0.10

1.0.10.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

09/03 2017

1.0.9

1.0.9.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

 

04/03 2017

1.0.5

1.0.5.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

  • ext-bcmath *
  • ext-calendar *
  • ext-ctype *
  • ext-curl *
  • ext-dom *
  • ext-exif *
  • ext-fileinfo *
  • ext-filter *
  • ext-gd *
  • ext-gettext *
  • ext-gmp *
  • ext-hash *
  • ext-iconv *
  • ext-imagick *
  • ext-json *
  • ext-mbstring *
  • ext-pdo_mysql *
  • ext-posix *
  • ext-readline *
  • ext-simplexml *
  • ext-ssh2 *
  • ext-xml *
  • ext-xmlreader *
  • ext-xmlwriter *
  • ext-zlib *
  • mongodb/mongodb ^1.0.0
  • php >=7.1.1

 

03/03 2017

1.0.4

1.0.4.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

  • ext-bcmath *
  • ext-calendar *
  • ext-ctype *
  • ext-curl *
  • ext-dom *
  • ext-exif *
  • ext-fileinfo *
  • ext-filter *
  • ext-gd *
  • ext-gettext *
  • ext-gmp *
  • ext-hash *
  • ext-iconv *
  • ext-imagick *
  • ext-json *
  • ext-mbstring *
  • ext-pdo_mysql *
  • ext-posix *
  • ext-readline *
  • ext-simplexml *
  • ext-ssh2 *
  • ext-xml *
  • ext-xmlreader *
  • ext-xmlwriter *
  • ext-zlib *
  • mongodb/mongodb ^1.0.0
  • php >=7.1.1

 

03/03 2017

v1.0.3

1.0.3.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

  • ext-bcmath *
  • ext-calendar *
  • ext-ctype *
  • ext-curl *
  • ext-dom *
  • ext-exif *
  • ext-fileinfo *
  • ext-filter *
  • ext-gd *
  • ext-gettext *
  • ext-gmp *
  • ext-hash *
  • ext-iconv *
  • ext-imagick *
  • ext-json *
  • ext-mbstring *
  • ext-pdo_mysql *
  • ext-posix *
  • ext-readline *
  • ext-simplexml *
  • ext-ssh2 *
  • ext-xml *
  • ext-xmlreader *
  • ext-xmlwriter *
  • ext-zlib *
  • mongodb/mongodb ^1.0.0
  • php >=7.0.1

 

03/03 2017

v1.0.2

1.0.2.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

  • ext-bcmath *
  • ext-calendar *
  • ext-ctype *
  • ext-curl *
  • ext-dom *
  • ext-exif *
  • ext-fileinfo *
  • ext-filter *
  • ext-gd *
  • ext-gettext *
  • ext-gmp *
  • ext-hash *
  • ext-iconv *
  • ext-imagick *
  • ext-json *
  • ext-mbstring *
  • ext-pdo_mysql *
  • ext-posix *
  • ext-readline *
  • ext-simplexml *
  • ext-ssh2 *
  • ext-xml *
  • ext-xmlreader *
  • ext-xmlwriter *
  • ext-zlib *
  • mongodb/mongodb ^1.0.0
  • php >=7.0.1

 

12/12 2016

v1.0.1

1.0.1.0 https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

  • ext-bcmath *
  • ext-calendar *
  • ext-ctype *
  • ext-curl *
  • ext-dom *
  • ext-exif *
  • ext-fileinfo *
  • ext-filter *
  • ext-gd *
  • ext-gettext *
  • ext-gmp *
  • ext-hash *
  • ext-iconv *
  • ext-imagick *
  • ext-json *
  • ext-mbstring *
  • ext-pdo_mysql *
  • ext-posix *
  • ext-readline *
  • ext-simplexml *
  • ext-ssh2 *
  • ext-xml *
  • ext-xmlreader *
  • ext-xmlwriter *
  • ext-zlib *
  • mongodb/mongodb ^1.0.0
  • php >=7.0.1

 

10/11 2016

v1.0.0-alpha

1.0.0.0-alpha https://github.com/katmore/flat

experimental framework for php

  Sources   Download

MIT GPL-3.0+

The Requires

  • ext-bcmath *
  • ext-calendar *
  • ext-ctype *
  • ext-curl *
  • ext-dom *
  • ext-exif *
  • ext-fileinfo *
  • ext-filter *
  • ext-gd *
  • ext-gettext *
  • ext-gmp *
  • ext-hash *
  • ext-iconv *
  • ext-imagick *
  • ext-json *
  • ext-mbstring *
  • ext-pdo_mysql *
  • ext-posix *
  • ext-readline *
  • ext-simplexml *
  • ext-ssh2 *
  • ext-xml *
  • ext-xmlreader *
  • ext-xmlwriter *
  • ext-zlib *
  • mongodb/mongodb ^1.0.0
  • php >=7.0.1