Load my classes to my project

I need your help. I want auto-includes my class to my project. But composer auto load don’t work. Please, help me.

—> composer.json


– src/publi/index.php - https://pastebin.com/17c41v0g
– src/composer.json - https://pastebin.com/KnLGUsU7

This isn’t a Slim issue, but try this:

"psr-4": {
    "Class\\": "src/classes/"

In your User.php at the top:

namespace Class;

class User {

Just some general tips:

  • The src/ directory is for the application specific PHP classes only.
  • Put your User.php class into the src/ sub-directory
  • The public/ directory should not be under the src/ directory
  • composer.json and vendor/ directory should be on top of the project root
  • Example: https://github.com/php-pds/skeleton

In your composer.json define the namespace paths like this:

"autoload": {
    "psr-4": {
        "App\\": "src"
"autoload-dev": {
    "psr-4": {
        "App\\Test\\": "tests"

Hi! Class ‘Classes\Test’ not found

new composer.json -> https://pastebin.com/KnLGUsU7
new index.php -> https://pastebin.com/17c41v0g
new Test.php -> https://pastebin.com/RuX9X6rm