Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access to composer autoloaded files in laravel 5

Trying to use a non-Laravel package: https://packagist.org/packages/luceos/on-app

Edited composer.json to require it and did the composer install, update, then dump-autoload -o.

This package requires an initialization: vendor/luceos/on-app/src/OnAppInit.php

Which isn't a class and only has the one method. But it doesn't seem to be loaded when I try to bind it in a service provider. The version for the cloud is initiated in the OnAppInit.php but that isn't being done so the "version isn't supported" error comes up of course.

I know that I am missing a small detail but can't find it. Maybe in the service provider??

composer.json

"require": {
    "luceos/on-app": "~3.5"
"autoload": {
    "psr-4": {
        "Luceos\\OnApp\\": "vendor/luceos/on-app/src/"

config/app.php

'providers' => [
    'App\Providers\OnAppServiceProvider',

app/Providers/OnAppServiceProvider.php

public function register()
    {
            $this->app->bind('onapp', function($app)
                {
                    $hostname = 'http://cloud';
                    $username = '[email protected]';
                    $password = 'api_key';
                    $factory = new \OnApp_Factory($hostname, $username, $password);
                    $setting = $factory->factory('Settings')->getList();
                    return $setting;
                });
    }

Looks like its there... vendor/composer/autoload_files.php

$vendorDir . '/luceos/on-app/src/OnAppInit.php',

vendor/composer/autoload_psr4.php

'Luceos\\OnApp\\' => array($vendorDir . '/luceos/on-app/src'),
like image 493
arikin Avatar asked Apr 27 '15 09:04

arikin


1 Answers

Regarding the Guzzle question: Just include it in your composer.json file:

"guzzlehttp/guzzle": "~5.0"

And then just use the normal

$client = new GuzzleHttp\Client();

Just don't forget to to composer dump-autoload

like image 176
Crembo Avatar answered Nov 03 '22 14:11

Crembo