0

I am learning how to create my first composer package.
To achieve that, I created the following public repository on my GH: https://github.com/Alphabetus/alpha-logger.

I managed to successfully install my package on a project but when i try to call the class from the package i get the following error: Output Error

The package code is public as mentioned, am i assigning the namespace wrong? On the test project I have the following:

  • composer.json:
[...]
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Alphabetus/alpha-logger"
        }
    ],
[...]
"require": {
    [...]
    "alphabetus/alpha-logger": "dev-master"
}
[...]
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },

The composer update command goes OK and i can see my own package on vendor/alphabetus/AlphaLogger

On my controller Im trying to call my logger class like this:

  • PageController.php
use AlphaLogger\Logger as Logger;
[...]

public function index(... ...)
{
    $l = new Logger();
    $l->test();
}
yivi
  • 42,438
  • 18
  • 116
  • 138
Alphabetus
  • 309
  • 3
  • 12

0 Answers0