A light-weight PHP MVC framework.
DISCLAIMER: Endo is provided as-is, and the author is not liable for any database losses that might occurr due to lax security.
Anyone familiar with CakePHP, Laravel, RoR or other Ruby-on-Rails-types will already know the drill:
- your development occurs in
/app
webroot
folders are public (helpfully calledpublic
in some other frameworks... :) )
See sample app for required structure & files.
This will install Endo to /endo
as a sibling to /app
:
git submodule add https://github.com/nemoDreamer/endo.git
cd endo
make install
cd ..
You can run ./endo/_sample/install.sh
to get a symlinked preview of what your directory structure and required files should look like, or simply copy the contents of endo/_sample/
into your root (as syblings of endo
).
<IfModule mod_rewrite.c>
RewriteEngine on
# endo webroot
RewriteRule ^assets/?(.*)$ endo/webroot/$1 [L]
# default
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
<?php
define('DOMAIN', 'my-awesome-app.com');
define('MYACTIVERECORD_CONNECTION_STR', 'mysql://<user>:<pwd>@'.$_ENV['DATABASE_SERVER'].'/<database>');
?>
<?php
/**
* APP Configure
* Define application-specific constants
* (can override ENDO constants defined in `/<ENDO_ROOT>/configure.php`)
*
* @author Philip Blyth
*/
define('LOCAL', strpos($_SERVER['SERVER_NAME'], 'localhost') !== false);
define('STAGING', strpos($_SERVER['HTTP_HOST'], 'staging') !== false);
define('DEBUG', LOCAL ? 1 : (STAGING ? 1: 0)); // 0:none | 1:basic | 2:basic+smarty
// --------------------------------------------------
// LAYOUT
// --------------------------------------------------
define('SITE_NAME', 'My Awesome App');
define('FOOTER', 'Joyfully produced by <a href="mailto:me@my-awesome-app.com">me</a>, yay!');
// --------------------------------------------------
// ROOTS && DB
// --------------------------------------------------
define('ENDO_ROOT', ROOT.'endo'.DS); // default
// switch for local dev environment
if (LOCAL) {
define('DOMAIN', 'localhost.com'); // point /etc/hosts localhost.com to 127.0.0.1
define('MYACTIVERECORD_CONNECTION_STR', 'mysql://root:root@localhost/endo_my-awesome-app');
} else {
include(APP_ROOT.'domain.inc');
}
// --------------------------------------------------
// ADMIN
// --------------------------------------------------
define('ADMIN_DEFAULT_CONTROLLER', 'posts');
?>
<?php
/**
* Index
* gets called first, via .htaccess
*
* this file needs to be overwriteable by any ulterior version!
* (use bootstrap for app-specific additions)
*
* @author Philip Blyth
*/
define('DS', DIRECTORY_SEPARATOR); // do not change!
// --------------------------------------------------
// ROOTS
// --------------------------------------------------
define('WEB_ROOT', dirname(__FILE__).DS); // do not change!
define('APP_ROOT', dirname(dirname(__FILE__)).DS); // do not change!
define('ROOT', dirname(dirname(dirname(__FILE__))).DS); // do not change!
// --------------------------------------------------
// CONFIG
// --------------------------------------------------
require_once(APP_ROOT.'configure.php');
// --------------------------------------------------
// CORE will handle the rest...
// --------------------------------------------------
require_once(ENDO_ROOT.'core.php');
?>
- Add LICENSE
- ! Use prepared statements !
- Add fallbacks for required files from
app
intoendo/packages