D
D
Damir Shaniyazov2022-02-18 15:00:31
Composer
Damir Shaniyazov, 2022-02-18 15:00:31

What is the reason Class not found?

Good afternoon! Installed the Laravel project, created a library folder in the root of the project, added a few classes. Then I try to use them, but the classes that are there are not there.

Class "library\Repositories\EloquentRepository" not found

What could be the problem? How can this be fixed?

Part of a class
<?php

namespace library\Repositories;

use library\Repositories\Contracts\Repository;
use ArrayAccess;
use Countable;
use IteratorAggregate;
use library\interfaces\Arrayable;

abstract class EloquentRepository extends BaseRepository implements Repository, Arrayable, ArrayAccess, Countable, \Iterator


default composer.json
{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "fruitcake/laravel-cors": "^2.0.5",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.0",
        "laravel/sanctum": "^2.14",
        "laravel/tinker": "^2.7",
        "ext-iconv": "*",
        "ext-simplexml": "*"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "spatie/laravel-ignition": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton R., 2022-02-18
@anton_reut

What could be the problem?

And it's like with an engine in a car - either there is nothing to burn or nothing to set fire to. Therefore, either the path is not correct or there is no class as such.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question