PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Till Wehowski   frdl Application Components Access Wrapper   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: frdl Application Components Access Wrapper
Register and access objects with aliases
Author: By
Last change: - using '$' shortcut
Date: 9 years ago
Size: 1,090 bytes
 

Contents

Class file image Download
<?php

require 'App.php';

/*
 * declaring an class for later using as alias
 * */
class myClass extends PDO {}

frdl\webfan\App::God(false, "Demo", null, false)
 
/*
  * predefined when init===true
  */
 
-> addShortCut('$', array(frdl\webfan\App::God(),'addShortCut'))
 
 
/*
   * Using Shortcut https://github.com/frdl/webfan/wiki/Lambada-Overloading-Syntax
   */
 
-> {'$'}('!write', (function($arg){$a = func_get_args(); echo $a[0];}) )
  ->{
'$'}('lnbr', (function(){echo '<br />'."\r\n";}) )
 
 
/*
   * Using Aliasing https://github.com/frdl/webfan/wiki/Aliasing
   */
 
-> setAlias('DB Wrapper', '\myDB', '\myClass', '\PDO',array())
  ->
mapAliasing(false)
  ->
applyAliasMap(true)
  ->
lnbr()
 ;


 
 
frdl\webfan\App::God()
  ->
lnbr()
  ->{
'$'}('showexamplecode', (function(){echo highlight_file(__FILE__, true);}) )
  ->
showexamplecode()
  ->
lnbr()
  -> {
'!write'}('Outputs: ')
  -> {
'!write'}('Hello world')
  -> {
'!write'}(' - and your PDO drivers')
  ->
lnbr()
  ;
 
  echo
print_r(\myDB::getAvailableDrivers(), true);
 
?>