Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

samuelgrant's avatar

Using a php library package within Laravel

Good Morning, I am still very new to Laravel, APIs and backend web development in general. But in the last few weeks I have learnt a heck of a lot and am now able to make Swagger API requests using GuzzleHttp.

As the API that I am learning with (Eve Online) gets updated regularly I would like to use a php library called Eseye. I have downloaded this through composer, and I am able to make requests.

The problem is I have to add the following code (below) to any controllers that make requests. Is there a way I can merge this into one import statement. . . Feel free to flick me a link to a video or forum post. I haven't been able to think of a good search term that would let me find one myself.

Regards.

use \Seat\Eseye\Cache\NullCache;
use \Seat\Eseye\Configuration;
use \Seat\Eseye\Containers\EsiAuthentication;
use \Seat\Eseye\Eseye; 


0 likes
2 replies
topvillas's avatar
Level 46

Put them in a controller and extend that.

class EveController extends Controller
{
    use \Seat\Eseye\Cache\NullCache;
    use \Seat\Eseye\Configuration;
    use \Seat\Eseye\Containers\EsiAuthentication;
    use \Seat\Eseye\Eseye; 
}
class ThisController extends EveController
{
}
samuelgrant's avatar

Ok, I had wondered if there was a better way to do it, but that will work. Thank-you so much!

Time to remove my messy guzzle codes and use a proper library.

As we say in Eve, fly safe o7

Please or to participate in this conversation.