DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:autoloader

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:autoloader [2016-04-28 15:58] andidevel:autoloader [2024-02-06 14:09] (current) – [Vendor Autoload] andi
Line 3: Line 3:
 DokuWiki registers its own autoloader early on in [[xref>inc/load.php]]. When developing plugins you nearly never need to require any other files yourself. DokuWiki registers its own autoloader early on in [[xref>inc/load.php]]. When developing plugins you nearly never need to require any other files yourself.
  
-Plugins components are automatically recognized by their naming scheme and [[plugin_file_structure|file_structure]]. However those should always be loaded via [[xref>plugin_load()]]. +Plugin components are automatically recognized by their naming scheme and [[plugin_file_structure|file_structure]]. However those should always be loaded via [[xref>plugin_load()]] or [[xref>loadHelper()]]. 
  
 If you need additional classes, simply use the appropriate namespace as outlined below. If you need additional classes, simply use the appropriate namespace as outlined below.
 +
 +===== Vendor Autoload =====
 +
 +When plugins have a ''vendor/autoload.php'' file it is automatically ''require''d by DokuWiki's autoloader. No need do that yourself anymore.
 +
  
 ===== Namespaces ===== ===== Namespaces =====
Line 14: Line 19:
  
   * ''\dokuwiki\'' - classes and subnamespaces are loaded from ''inc/*''   * ''\dokuwiki\'' - classes and subnamespaces are loaded from ''inc/*''
-  * ''\dokuwiki\plugin\'' - classes are loaded from ''lib/plugins/*'' [[develonly]] +  * ''\dokuwiki\test''used with [[devel:unittesting]], classes and subnamespaces are loaded from ''_test/tests/*'' 
-  * ''\dokuwiki\plugin\*\test\'' - classes are loaded from ''lib/plugins/*/_test/*'' [[develonly]]+  * ''\dokuwiki\test\mock'' - used with [[devel:unittesting]], classes and subnamespaces are loaded from ''_test/mock/*'' 
 +  * ''\dokuwiki\plugin\'' - classes are loaded from ''lib/plugins/*'' 
 +  * ''\dokuwiki\plugin\*\test\'' - classes are loaded from ''lib/plugins/*/_test/*'' 
 +  * ''\dokuwiki\template\'' - classes are loaded from ''lib/tpl/*'' 
 +  * ''\dokuwiki\template\*\test\'' - classes are loaded from ''lib/tpl/*/_test/*'' 
devel/autoloader.1461851897.txt.gz · Last modified: 2016-04-28 15:58 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki