Skip to main content
1 de 3
Syzoth
  • 100,5mil
  • 23
  • 169
  • 361

O tal classes precisa estar no composer.json, já que o Slim usa composer-autoload, por exemplo:

"autoload": {
    "psr-4": {
        "Slim\\": "Slim",
        "Classes\\": "Classes"
    }
},

O Classes\\ é o prefixo para indentificar pelo namespace, e o "Classes" é a pasta aonde estão localizadas, deve ficar semelhante a isto:

{
    "name": "slim/slim",
    "type": "library",
    "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
    "keywords": ["framework","micro","api","router"],
    "homepage": "https://slimframework.com",
    "license": "MIT",
    "authors": [
        {
            "name": "Josh Lockhart",
            "email": "[email protected]",
            "homepage": "https://joshlockhart.com"
        },
        {
            "name": "Andrew Smith",
            "email": "[email protected]",
            "homepage": "http://silentworks.co.uk"
        },
        {
            "name": "Rob Allen",
            "email": "[email protected]",
            "homepage": "http://akrabat.com"
        },
        {
            "name": "Gabriel Manricks",
            "email": "[email protected]",
            "homepage": "http://gabrielmanricks.com"
        }
    ],
    "require": {
        "php": ">=5.5.0",
        "pimple/pimple": "^3.0",
        "psr/http-message": "^1.0",
        "nikic/fast-route": "^1.0",
        "container-interop/container-interop": "^1.2",
        "psr/container": "^1.0"
    },
    "require-dev": {
        "squizlabs/php_codesniffer": "^2.5",
        "phpunit/phpunit": "^4.0"
    },
    "provide": {
        "psr/http-message-implementation": "1.0"
    },
    "autoload": {
        "psr-4": {
            "Slim\\": "Slim",
            "Classes\\": "Classes"
        }
    },
    "scripts": {
        "test": [
            "@phpunit",
            "@phpcs"
        ],
        "phpunit": "php vendor/bin/phpunit",
        "phpcs": "php vendor/bin/phpcs"
    }
}

Depois de adicionar no composer.json execute o comando:

composer update

Assim estará disponivel no composer-autoload


Leia mais sobre composer

Syzoth
  • 100,5mil
  • 23
  • 169
  • 361