Why not wrap the logic in a repository class. You can still consume all your helpers and models.
Create your folder app/Library/Algorithms
Then in composer.json:
"autoload":{
"classmap":[
"app/Library"
],
"psr-0":{
"Algorithms": "app/Library"
}
}
For example in app/Library/Algorithms you have following folders:
Each of this php files should be namespaced as Algorithms\Sorting. SortServiceProvider should use and extend \Illuminate\Support\ServiceProvider and make all bindings between interfaces and implementations.
In Facade classes extends \Illuminate\Support\Facades\Facade and implements the public static method getFacadeAccessor, ex:
class BubbleSortFacade implements \Illuminate\Support\Facades\Facade{
public static function getFacadeAccessor(){
return "Algorithms\Sorting\IBubbleSort"
}
}
Then you can add your provider to app/config.php in providers array:
'Algorithms\Sorting\SortServiceProvider'
And Facades to aliases array (in app/config.php):
'BS' => 'Algorithms\Sorting\BubbleSortFacade'
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community