Reputation: 4013
I am developing a package in laravel
which uses model for CRUD operations.
I have put it up in packagist as well, but when I try to install it in laravel application and visit a route defined by the package, it says
Class 'Zusamarehan\Tourify\Model\Tourifies' not found
The following is the folder structure of my package
The following is the contents of my Tourifies.php
<?php
namespace Zusamarehan\Tourify\Model;
use Illuminate\Database\Eloquent\Model;
class Tourifies extends Model
{
}
The following is my composer.json
file
{
"name": "zusamarehan/tourify",
"description": "A Package for adding Tour/Help to your Laravel Projects.",
"keywords": ["laravel", "tour", "tourify", "product-tour", "product-help"],
"type": "library",
"license": "MIT",
"authors": [
{
"name": "zusamarehan",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"extra": {
"laravel": {
"providers": [
"Zusamarehan\\tourify\\TourifyServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Zusamarehan\\tourify\\": "src"
}
}
}
The Model class is not loading I suppose? I am not sure.
Can someone point out the mistake?
Upvotes: 3
Views: 448
Reputation: 35180
The namespaces in your classes use Zusamarehan\Tourify
, however, in your composer.json
you've used Zusamarehan\tourify
. These should match.
You'll need to update your composer.json
file so that the namespaces uses the correct case:
{
"name": "zusamarehan/tourify",
"description": "A Package for adding Tour/Help to your Laravel Projects.",
"keywords": ["laravel", "tour", "tourify", "product-tour", "product-help"],
"type": "library",
"license": "MIT",
"authors": [
{
"name": "zusamarehan",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"extra": {
"laravel": {
"providers": [
"Zusamarehan\\Tourify\\TourifyServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Zusamarehan\\Tourify\\": "src"
}
}
}
Upvotes: 2
Reputation: 2116
"Zusamarehan\\tourify\\": "src"
in your composer.json
is wrong. Needs uppercase T
. Looking at mine I also have a trailing /
after src
so you can try that as well.
You have the same lowercase t
in the provider.
Upvotes: 1