How To Add Custom Helper / Library in App
Just Like Codeigniter or any other php framework, they have Helper / Library for custom function & library
function allowTags($text) {
$tags = '<strong><h1><h2><h3><h4><br><hr><b><ol><ul><u><span><li><a><img><iframe>';
return strip_tags(html_entity_decode(trim($text)), $tags);
}
for example I create multiple Controller and want to call the function allowTags() in any controller
@walkor , @passwalls , please I really need this feature. I would definitely donate this project soon
Webman currently does not strictly specify the location of custom function & library.
You can put your helper functions into for example app/functions.php.
And add line "./app/functions.php" in composer.json like this.
"autoload": {
"files": [
"./support/helpers.php",
"./app/functions.php"
]
},
Run command composer dump-autoload then the ./app/functions.php will be loaded automatically .
Make your class file conform to psr4 rules, and it will be loaded automatically. For example app/common/User.php.
namespace app\common;
class User
{
}
It will be loaded automatically when it used.
Oh, Ok i got it. For temporary I will using composer psr4