Liaison

Liaison is a web-framework focused on building portable web-app libraries, and websites built from those libraries.

Liaison apps should work with any website / web-framework, but some integration setup may be required.

Install

composer require taeluf/liaison v1.0.x-dev   

or in your composer.json

{"require":{ "taeluf/liaison": "v1.0.x-dev"}}  

Documentation

TODO: Create all this documentation

  • Getting Started - Create an example website & app to get an overview of Liaison's features & development experience.
  • Develop Apps - Develop apps that are easily shared with other Liaison websites/apps.
  • Build Websites - Build a website.
  • Install Apps - Install apps on your website, or depend on them within your app.
  • Features
    • Routing - Delivering raw files, php script files, or callable routes
    • Seo - Setting meta information for SEO engines
    • Cache - Using the Liaison Cache
    • Events/Hooks - Hook into app and server events
    • Css & Js - Compiling and Delivering javascript & css resources
    • Views - Reusable Templates
    • Error Handling - Displaying & logging errors
    • Redirecting - Redirecting to different pages
    • Autoloading - You should just use composer, but I guess you can use Liaison's autoloader.
  • Write Documentation - How to write & auto-generate your documentation

Liaison App

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.

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.

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.

<?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();