Liaison

Liaison is a web-framework focused on building portable web-app libraries, while allowing for fully-functioning web-servers.

The intent is to make any Liaison app easily installable into any website, regardless of the framework at play. Unfortunately, the current version & documentation are mainly geared toward Liaison-powered web-servers.

Documentation incomplete. our old README for more.

Install

composer require taeluf/liaison v0.6.x-dev   

or in your composer.json

{"require":{ "taeluf/liaison": "v0.6.x-dev"}}  

Documentation

  • Usage - Basic Usage of Liaison & it's built-in app.
  • Libraries - Build a library
  • Web servers - Use Liaison as your web server
  • TODO Integration - Integrate a Liaison app into your (non-liaison) web server
  • TODO Simple Server - a Liaison subclass that simplifies setting up certain features for a website.
  • TODO Generating Documentation - Generate documentation of all your webserver or app's features (routes, views, & more).

Liaison App (aka Package)

A Liaison app can include routes, views, methods, hooks, and more. You can include as few or as many parts as you like.

Libraries typically do one of two things: create features for other libraries to use or implement features other libraries provide. Most features are created through Addons. Most features are implemented through directory structures & configurations.

See Library Documentation for more.

App Directory Structure

You can include one, multiple, or all of these directories.

App/  
    - config.json <- Package settings  
    - public/ <- Public files to be routed to.   
        - index.php <- home page  
        - contact.php <- /contact/  
    - view/ <- Views  
        - theme.php <- site layout  
        - theme.css  
    - addon/ <- Addons (extend \Lia\Addon)  
        - MyAddon.php  
    - class/ <- Classes to autoload, PSR4 style, but you should use composer instead.  

Liaison Web Server

A web server typically includes a self-made Liaison app (for themes, views, and routes), a configuration file, environment settings, and a deliver.php script for setting up your Site's app and any other apps you're using.

See WebServer Documentation for more.

Webserver Directory Structure

This is a sample structure, and you're welcome to use your own.

DOCUMENT_ROOT  
    - .env/ <- Your environment configs  
    - .htaccess <- Used by apache to route to your deliver.php  
    - composer.json   
    - deliver.php <- Every request is routed through this file  
    - site/ <- Your primary Liaison app, with your theme & core pages & features.  
        - public/index.php <- your home page  
    - apps/ <- Additional apps you develop, to organize different features of your website  
    - deliver/ <- Optional directory to organize different aspects of your setup  

deliver.php

This script sets up your webserver & delivers a response.

Note: Apps are setup by the Package class

<?php  
$lia = new \Lia();  
  
// Add the built-in App, which provides all the web-server features.  
$server_app = new \Lia\Package\Server($lia, $fqn='lia:server', ?$dir, ?$base_url);  // dir & base_url not required  
  
// Add your app, providing home page & other core pages & features  
$site_app = new \Lia\Package\Server($lia, 'myname:site', __DIR__.'/site/');  
  
// delivers files in `site/public/*`   
$lia->deliver();  

See the WebServer Documentation for configuring your database, handling static files, file uploads, debugging, documentation, and other features.