Giter VIP home page Giter VIP logo

php_mvc_framework's Introduction

PHP Common Framework

Version 0.1

####PHP MVC Framework

The PHP MVC Framework utilizes a REST backend built in Slim PHP (providing Routes, Middleware, Server-Side Caching, Generic Views, etc.), the Idiorm ORM, Smarty Templates, and components from Symfony.

The Idiorm ORM implemented in the Models allows for abstractions and definitions of the underlying database, including business logic and data manipulation (all queries are handled by this ORM, which also accepts raw SQL in part or full as needed).

The Controllers are generally called by paths defined in the Routes and serve to delegate tasks and manage updates to the Models and Views. Views in the default application utilize Smarty templates for HTML delivery and can receive a request for JSON data for API access from other clients.

Directory Overview (High-Level)

####Base:

/
/.htaccess
/php.ini
/README.md
/app/
/public/
/settings.php

####Public App Note: .htaccess rewrites requests to index.php when that URI points to a resource that is dynamic (ignoring static files which reside in the public/ directory.

/public/
/public/index.php
/public/js/
/public/js/app.js
/public/js/vendor/
/public/css/
/public/css/app.css
/public/css/vendor/
/public/css/vendor/images/
/public/images/

####App Root:

/app/
/app/Core.php

/app/Models/
/app/Views/
/app/Controllers/

/app/lib/
/app/routes/
/app/tests/
/app/vendor/

####App Libraries

/app/lib/Authentication/
/app/lib/Authentication/Authentication.php
/app/lib/Authentication/AuthSession.php
/app/lib/Connection/
/app/lib/Connection/Connection.php
/app/lib/Connection/Config.php
/app/lib/Image/Image.php

####App Routes

/app/routes/
/app/routes/Routes.php
/app/routes/groups/
/app/routes/groups/*.php

####App View Templates and Smarty Directories

/app/smarty/templates/
/app/smarty/templates/*.tpl
/app/smarty/templates/index.tpl
/app/smarty/templates/include/
/app/smarty/templates/include/*.tpl
/app/smarty/templates/include/layout.tpl
/app/smarty/config/
/app/smarty/cache/
/app/smarty/templates_c/

####Third-party Vendor Code for APP

/app/vendor/
/app/vendor/Slim/
/app/vendor/Smarty/
/app/vendor/idiorm.php

####Other details within the Application:

  • vendor indicates any third-party resource
  • lib indicates custom modules used througout the APP
  • routes indicates APP routing, grouping routes and included in Routes.php
  • public is specific to the client interface
  • scripts is where migration scripts and other server-side utilities are stored
  • templates includes *.tpl files for rendering HTML fragments
  • tests includes any APP tests we may wish to include
  • /app/Controllers/ stores application controller logic
  • /app/Models/ stores application model business logic
  • /app/Views/ stores application views, which render to templates or return JSON data

####Session Management:

  • /(App-base)/sessions/ - Stores sessions outside of public app directory

####Initializing the APP

The following code fragments illustrate how to bootstrap the APP in an application:

require_once 'app/Core.php';

$config = array(
        'debug' => true
);

$base = new BASE( $config );
$base->init();

$app = \Slim\Slim::getInstance();

$app->get('/', function() use ($app) 
{
	$view = new IndexView(); // Assuming you have an IndexView class included
        echo  $view->render();
});

$app->run();

At this point, the Slim object can be referenced in any custom application via:

$app_singleton_reference = \Slim\Slim::getInstance();

###Links to Components Used in this Application

php_mvc_framework's People

Contributors

jurevans avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.