/**
* (c) - by webfan.de (TW)
*
*
* This file demonstrates how to implement psr-4 autoloading into
* the PragmaMx CMS.
*
* Readme: Just include and edit this file!
*
* [color=red] EDIT SourceLoader.php to DISABLE Remote-Autoloading![/color]
*/
http://frdl.de/frdlpmx-bridge.zip
Hallo,
wie wäre es dann mal mit einer genauen Beschreibung, bevor ich mir irgendwas runterlade?
LG
Hallo Sven,
sorry, momentan habe ich dafür keine Zeit.
Der Beitrag ist im Bereich "Coder und Bastlerecke" und richtet sich an (die) Entwickler, bei denen ich vorraussetze, daß sie den Code lesen können.
Mehr Informationen u.U. zu gegebener Zeit.
Einen schönen Sonntag wünsche ich Allen!
...es geht lediglich darum ein Beispiel aufzuzeigen für ein "vernünftiges" Autoloading.
Es handelt sich um eine "Bridge" für pmx und meinem Projekt http://frdl.github.io/webfan/
Bridge ist hier zuviel gesagt, Beispiel datei ist die bridge.php im zip Paket:
<?php
/**
* (c) - by webfan.de (TW)
*
*
* This file demonstrates how to implement psr-4 autoloading into
* the PragmaMx CMS.
*
* Readme: Just include and edit this file!
*
* EDIT SourceLoader.php to DISABLE Remote-Autoloading!
*/
defined('mxMainFileLoaded') or die('access denied');
$dir_lib = realpath(__DIR__. DIRECTORY_SEPARATOR . 'webfan-master' . DIRECTORY_SEPARATOR. 'lib' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
require $dir_lib . 'frdl' . DIRECTORY_SEPARATOR . 'webfan' . DIRECTORY_SEPARATOR . 'Autoloading' . DIRECTORY_SEPARATOR . 'SourceLoader.php';
require $dir_lib . 'frdl' . DIRECTORY_SEPARATOR . 'webfan'.DIRECTORY_SEPARATOR . 'App.php';
$Woggle = frdl\webfan\App::God(true, "frdl - AC - PragmaMx Bridge (schmeckt.at)", 'frdl\webfan\Autoloading\SourceLoader', false)
->init_autoloader(true)
-> addNamespace('', $dir_lib , true)
-> addNamespace('webdof\\', $dir_lib . 'webdof'.DIRECTORY_SEPARATOR, false)
-> addNamespace('webfan\\', $dir_lib . 'webfan'.DIRECTORY_SEPARATOR, false)
-> addNamespace('frdl\\', $dir_lib . 'frdl'.DIRECTORY_SEPARATOR, false)
->j()
//example:
->{'$'}('o', (function($arg){$a = func_get_args(); echo $a[0];}) )
-> {'o'}('Hello world')
;
:puzzled: :BD:
Hallo,
danke für die Info.
LG Sven
Hallo allerseits,
es gibt hier nun einen Wiki zur Dokumentation:
https://github.com/frdl/webfan/wiki
:bye:
Um das remote Autoloading zu deaktivieren, Beispiel:
<?php
//...
/**
*
* Disable remote autoloading:
*
**/
webfan\Loader::top()
-> unregister(array(webfan\Loader::top(),'autoloadClassFromServer'))
;
//...
?>
Und das kann ich einfach runterladen ja?
Hallo Twerk,
ZitatUnd das kann ich einfach runterladen ja?
Ja, hier z.B.: https://github.com/frdl/webfan
Lizenz: BSD style https://github.com/frdl/webfan/blob/master/LICENSE.md
Viele Grüße
Till
Super, vielen lieben Dank fürs bereitstellen :thumbup:
Hello ! :smile:
is it working with pmx 1.12 ?
Hello shorty,
yes, I have this library running succesfully in for example pmx 1.12.1, 2.1.2, and some modified systems...
Maybe modifications are necessary or recommended.
As this is for Autoloading it is usefull to place it at the beginning of your script, for example mainfile.php .
Over time since the first post, I added some changes.
ZitatThe frdl\webfan\Autoloading\SourceLoader autoloader class provides to use the following autoloader strategies or a mix of them within one application:
psr-0
psr-4
class mapping
Remote (RPC)
You can find the wiki as well as the source at github:
Autoloading (Wiki) (https://github.com/frdl/webfan/wiki/Autoloading)
You can also find the latest version at phpclasses.org.
I am also nominated for an award April 2015,
please vote for the class, if you like it (click on "vote" to do it ...):
http://www.phpclasses.org/package/9071-PHP-Autoload-classes-with-PSR-0-PSR-4-mapping-etc-.html
:bye:
Edit:
<?php
/**
* SourceLoader example usage
*/
require 'SourceLoader.php';
frdl\webfan\Autoloading\SourceLoader::top()
-> addPsr4('frdl\\', DIRECTORY_SEPARATOR . 'pathToDir' . DIRECTORY_SEPARATOR, true)
-> addPsr0('aNamespace\\', DIRECTORY_SEPARATOR . 'pathToDir-Old' . DIRECTORY_SEPARATOR, false)
-> class_mapping_add('MyClass', DIRECTORY_SEPARATOR . 'pathToDir' . DIRECTORY_SEPARATOR .'cl.MyClass.php', $success)
-> autoload_register()
-> unregister(array(frdl\webfan\Autoloading\SourceLoader::top(),'autoloadClassFromServer'))
;
Further:
https://github.com/frdl/webfan/issues/16
https://github.com/frdl/webfan/wiki/Troubleshooting