Your startup configuration is almost good, but you have
- invalid namespaces
- Wrong Way
To fix the problem, configure the startup configuration:
{ "autoload": { "classmap": [ "database" ], "psr-4": { "App\\": "app/" } } }
Then rename the /library directory to /library (note the case).
Then rename the file /app/Library/helper.php to /app/Library/MyHelper.php (note how the class name should match the file name).
Then edit the namespace of the class provided by /app/Library/MyHelper to match the PSR-4 prefix (and therefore the structure of your project), as well as the classβs customs:
namespace App\Library; class MyHelper { public function v($arr) { var_dump($arr); } }
For reference see:
source share