Composer repository git class not found with Laravel

539 Views Asked by At

I've added a repository git as a composer dependency to my project.

"repositories": [
        {
            "type":"package",
            "package": {
                "name": "Neabfi/SDK-PHP",
                "version":"3.1.2",
                "source": {
                    "url": "https://github.com/Neabfi/SDK-PHP.git",
                    "type": "git",
                    "reference":"master"
                }
            }
        }
    ],
    "require": {
        "Neabfi/SDK-PHP": "3.1.2"
    },

In this repository there is a Client class :

<?php

namespace RecastAI;

/**
 * Class Client
 * @package RecastAI
 */
class Client { ... }

When i try to use it.

<?php

use RecastAI\Client;

[...]

$client = new Client(env('RECAST_REQUEST_TOKEN'), env('RECAST_LANGUAGE'));

[...]

It seems that he cant find it :

[2017-07-26 15:30:50] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Class 'RecastAI\Client' not found in /Users/fabien/Sites/abote/app/Recast.php:20
Stack trace:
1

There are 1 best solutions below

1
On

You should try this in your composer.json:

"repositories": [
    {
      "type": "git",
      "url": "https://github.com/Neabfi/SDK-PHP.git"
    }
  ],

And keep the require section as you have it, perform composer install, and that's it.