Thursday 14 February 2019

Laravel how to create library class (updated)

 Basically, you could create another directory within app, and then namespace your files in there as appropriate:
app/CustomStuff/CustomDirectory/SomeClass.php.
Then, within your SomeClass.php, make sure you namespace it:
<?php namespace App\CustomStuff\CustomDirectory;

class Someclass {}
Now, you can access this class using the namespace within your classes:
use App\CustomStuff\CustomDirectory\SomeClass;
then $obj = new SomeClass();


https://stackoverflow.com/questions/26942390/how-to-add-my-own-custom-class-in-laravel-5

https://arjunphp.com/load-custom-class-laravel-5/

No comments:

Post a Comment