dimanche 18 mai 2014

php - classe de package compositeur n'a ne pas trouvé - Stack Overflow


I'm trying to create a composer package but I'm getting a class not found error. I'm using Laravel 4 but I'm trying to create a generic PHP package.


I created the package in my vendor/ directory.


vendor/
theninthnode/
defaqto/
src/
Defaqto.php
vendor/
composer.json

Here is my composer.json file


{
"name": "theninthnode/defaqto",
"description": "",
"authors": [
{
"name": "Billy Jones",
"email": "billyjones26@gmail.com"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": ["src"]
}
}

And my class:


<?php

class Defaqto
{
....
}

When I try to call the package class from my app like so


$defaqto = new Defaqto();

I just get


Class 'Defaqto' not found

I've tried composer dump-autoload from within my package and also my applications root.


I also tried adding theninthnode/defaqto to my root composer.json file.


Am I missing something?



I'm trying to create a composer package but I'm getting a class not found error. I'm using Laravel 4 but I'm trying to create a generic PHP package.


I created the package in my vendor/ directory.


vendor/
theninthnode/
defaqto/
src/
Defaqto.php
vendor/
composer.json

Here is my composer.json file


{
"name": "theninthnode/defaqto",
"description": "",
"authors": [
{
"name": "Billy Jones",
"email": "billyjones26@gmail.com"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": ["src"]
}
}

And my class:


<?php

class Defaqto
{
....
}

When I try to call the package class from my app like so


$defaqto = new Defaqto();

I just get


Class 'Defaqto' not found

I've tried composer dump-autoload from within my package and also my applications root.


I also tried adding theninthnode/defaqto to my root composer.json file.


Am I missing something?


0 commentaires:

Enregistrer un commentaire