Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nemodreamer/endo

Light-weight PHP MVC framework.
https://github.com/nemodreamer/endo

Last synced: 10 days ago
JSON representation

Light-weight PHP MVC framework.

Awesome Lists containing this project

README

        

# Endo

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.

---

## Using Endo

### Basic Concepts

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 called `public` in some other frameworks... :) )

## Basic Setup

### Directory Structure

See sample app for required structure & files.

### Installing Endo

This will install **Endo** to `/endo` as a sibling to `/app`:

```Shell
git submodule add https://github.com/nemoDreamer/endo.git
cd endo
make install
cd ..
```

## Required Files

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`).

### `/.htaccess` URL re-writes

```ApacheConf

RewriteEngine on

# endo webroot
RewriteRule ^assets/?(.*)$ endo/webroot/$1 [L]

# default
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

```

### `/app/.htaccess` to protect `/app`

```ApacheConf

RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]

```

### `/app/.htaccess` to protect `/app`

```ApacheConf

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

```

### `/app/domain.inc` to define domain and SQL connection string

```PHP
:@'.$_ENV['DATABASE_SERVER'].'/');
?>
```

### `/app/configure.php` defines application-specific constants

```PHP
/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 me, 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');

?>
```

### `/app/webroot/index.php` loads the app

```PHP

```

## TODO

- Add LICENSE
- ! Use prepared statements !
- Add fallbacks for required files from `app` into `endo/packages`