I have installed axiom/rivescript with Composer for a PHP project I can't instantiate the rivescript object

182 Views Asked by At

I install rivescript with Composer and there doesn't seem to be any problem, but when I create the index file, it doesn't let me instantiate the object, it's like it doesn't recognize the class, I attach here the index file, the autoload file and the composer.json

<?php

require_once 'vendor/autoload.php';

use \Axiom\Rivescript\Rivescript;

$rivescript = new Rivescript();

?>

I've also tryed the namespace Axiom\Rivescript\Rivescript; and I have the same result. The error is: Undefined type 'Axiom\Rivescript\Rivescript'.

This is the autoload file vendor/autoload:

<?php

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
    echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
    exit(1);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit6e94c1dfe0127ae71204e2c39639f059::getLoader();

?>

And this is composer json file vendor\axiom\rivescript\composer.json:

{
    "name": "axiom/rivescript",
    "description": "RiveScript interpreter library for PHP with Laravel support. RiveScript is a scripting language for chatterbots, making it easy to write trigger/response pairs for building up a bot's intelligence.",
    "keywords": ["rivescript", "bot", "ai", "chatterbot", "axiom"],
    "license": "MIT",
    "authors": [
        {
            "name": "Shea Lewis",
            "email": "[email protected]"
        }
    ],
    "require": {
        "php": ">=7.1",
        "symfony/console": "~3.0",
        "symfony/finder": "^3.2",
        "axiom/collections": "~2.0"
    },
    "require-dev": {
        "phpunit/phpunit": "~5.0",
        "monolog/monolog": "~1.0"
    },
    "autoload": {
        "files": [
            "src\\helpers.php"
        ],
        "psr-4": {
            "Axiom\\Rivescript\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "branch-alias": {
            "dev-develop": "1.0.x-dev"
        }
    },
    "minimum-stability": "stable"
}
0

There are 0 best solutions below