App is responsible for resource location, and path management.
Additional paths for Templates and Plugins are configured with Configure now. See config/app.php for an example. The App.paths.plugins
and App.paths.templates
variables are used to configure paths for plugins and templates respectively. All class based resources should be mapped using your application's autoloader.
You can inspect the currently loaded paths using App::path('Controller')
for example to see loaded controller paths.
It is also possible to inspect paths for plugin classes, for instance, to get the path to a plugin's helpers you would call App::path('View/Helper', 'MyPlugin')
Plugins can be located with App as well. Using Plugin::path('DebugKit') for example, will give you the full path to the DebugKit plugin.
_classExistsInBase( string $name , string $namespace )
_classExistsInBase
Test isolation wrapper
$name
$namespace
boolean
className( string $class , string $type '' , string $suffix '' )
Return the class name namespaced. This method checks if the class is defined on the application/plugin, otherwise try to load from the CakePHP core
$class
$type
optional '' $suffix
optional '' boolean|string
core( string $type )
Returns the full path to a package inside the CakePHP core
Usage:
App::core('Cache/Engine');
Will return the full path to the cache engines package.
$type
array
path( string $type , string $plugin null )
Used to read information stored path
Usage:
App::path('Plugin');
Will return the configured paths for plugins. This is a simpler way to access the App.paths.plugins
configure variable.
App::path('Model/Datasource', 'MyPlugin');
Will return the path for datasources under the 'MyPlugin' plugin.
$type
$plugin
optional null array
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/3.1/class-Cake.Core.App.html