File code/class/Simple.php

class Lia\Simple

See source code at /code/class/Simple.php

Constants

Properties

  • public array $phads = [];
  • public bool $debug = false;
  • public string $last_feature = null; The feature currently being enabled or the last feature enabled if one is not currently being enable.
  • public array $features = []; array of $feature_name=>true

Methods

  • static public function get_lia_instance(string $file_path): \Lia require a php file that instantiates a Lia instance & return that instance, without routing, sending a server response, or outputing any text.
    May not work with unconventional setups. Requires a variable named $lia at $file_path
  • public function __construct()
  • public function is_production() Check if current server is a production server
  • public function require_feature(string $feature)
  • public function setup()
  • public function deliver_files(...$public_dirs)
  • public function load_apps(...$app_dirs)
  • public function load_app($app_dir)
  • public function enable(string $feature, $app=null)
  • public function enable_defaults($app)
  • public function enable_debug_fake_user_mail($app)
  • public function enable_phad($app)
  • public function phad_from_dir(string $target_dir): \Phad Get a phad instance who's `$phad->item_dir == $target_dir``
  • public function enable_user($app)
  • public function enable_env($app)
  • public function enable_pdo($app)
  • public function enable_pdo_mysql($app)
  • public function enable_pdo_sqlite($app)
  • public function enable_ldb($app)
  • public function enable_analytics($app) 1. Save the current page to analytics
  1. Enable the analytics route, if phad is enabled

Set $_SERVER['DO_NOT_RESPOND'] = true to disable the analytics feature. Useful for cli environments

  • public function enable_error_page($app) enable the route /generic-error-page/ to display 'Unknown Error' message.

  • public function respond()

  • public function debug()

  • public function get_all_sitemap_routes($sm_builder) get an array of all routes for the sitemap

  • public function markdown_to_html(string $markdown) Convert markdown to html, if CommonMark is installed

  • public function phad_item(string $item, array $args = [])

  • public function init_analytics_table(\PDO $pdo) Initialize your analytics table. Recommend using a local sqlite database.

  • public function create_phad_table(\Phad $phad, string $form_item): string Generate an sql CREATE TABLE statement from a phad item containing a form.

  • function send_mail(string $to, string $reply_to, $subject, $body) Send an email through SMTP
    You MUST set the following settings to R: smtp.host, smtp.user, smtp.password, Business.Name

  • public function log()

  • public function __isset($prop)

  • public function __get($prop) get the named property or addon if property not found

  • public function __set($prop, $value)