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

jgravois's avatar

Can Laravel 5 Use Raw PHP Libraries

I am trying to pull in a PHP Stock Ticker (https://github.com/scheb/yahoo-finance-api) which uses composer but no mention of Laravel.

Is there a way to use this in Laravel 5.1?

0 likes
4 replies
jgravois's avatar

and do I just put $client = new \Scheb\YahooFinanceApi\ApiClient(); on top of the controller?

ashitvora's avatar
Level 4

Not on top of Controller of course but within your controller methods.

eg.

namespace \App\Http\Controllers;

use \App\Http\Controller;
use Scheb\YahooFinanceApi\ApiClient;

class MyController extends  Controller{
    protected $apiClient;

    public __construct(){
        $apiClient = new \Scheb\YahooFinanceApi\ApiClient();
    }
}
jgravois's avatar

@ashitvora Thanks!!! I was thinking it was like a "use App\User;" kinda thing but it's just Composer magic.

Please or to participate in this conversation.