S
S
Stanislav Pochepko2016-12-21 18:12:35
Composer
Stanislav Pochepko, 2016-12-21 18:12:35

Trouble creating package for laravel?

Good afternoon. I am creating my first package for laravel and have a problem.
When I try to connect my package to the project from a local folder or repository, I get the following error

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for laravel/laravel dev-access-managment -> satisfiable by laravel/laravel[dev-access-managment].
    - djzt/sentinel-laravel-auth-driver dev-master requires laravel/laravel 5.1.* -> satisfiable by laravel/laravel[5.1.x-dev, v5.1.0, v5.1.1, v5.1.11, v5.1.3, v5.1.33, v5.1.4].
    - Can only install one of: laravel/laravel[5.1.x-dev, dev-access-managment].
    - Can only install one of: laravel/laravel[v5.1.0, dev-access-managment].
    - Can only install one of: laravel/laravel[v5.1.1, dev-access-managment].
    - Can only install one of: laravel/laravel[v5.1.11, dev-access-managment].
    - Can only install one of: laravel/laravel[v5.1.3, dev-access-managment].
    - Can only install one of: laravel/laravel[v5.1.33, dev-access-managment].
    - Can only install one of: laravel/laravel[v5.1.4, dev-access-managment].
    - Installation request for djzt/sentinel-laravel-auth-driver dev-master -> satisfiable by djzt/sentinel-laravel-auth-driver[dev-master].

djzt/sentinel-laravel-auth-driver dev-master is my package
composer.json
{
    "name": "djzt/sentinel-laravel-auth-driver",
    "description": "Sentinel auth driver for laravel 5.1",
    "require": {
        "cartalyst/sentinel": "2.0.*"
    },
    "authors": [
        {
            "name": "DJZT",
            "email": "[email protected]"
        }
    ],
    "minimum-stability": "dev",
    "autoload": {
      "classmap": [],
      "files": [],
      "psr-4": {
          "Djzt\\SentinelLaravelAuthDriver\\": "src/"
    }
  }
}

composer.json of the project
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "cartalyst/sentinel": "2.0.*"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^2.1",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "repositories": [
        {
          "type": "path",
          "url": "/packages/SentinelLaravelAuthDriver"
        }
    ],
    "autoload": {
        "classmap": [
            "database",
            "app/collections"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

What have I done wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
giroskop grospop, 2018-02-07
@Limo

If I don't confuse anything, you need to do something like this

"psr-4": {
            "App\\": "app/",
            "namespace-your-project\\": "packages/SentinelLaravelAuthDriver"
        }

And remove repositories
PS. Provided that you pull it from a local folder

S
Samuel_Leonardo, 2020-09-11
@Samuel_Leonardo

I suppose the problem is in the path
"url": "/packages/SentinelLaravelAuthDriver"
and instead of the local package, you have a package loaded from the repository, and there

"require": {
        "cartalyst/sentinel": "2.0.*",
        "laravel/laravel": "5.1.*"
    },

what composer actually complains about when demanding branch 5.1
, use the full path or change the current one to "./packages/SentinelLaravelAuthDriver"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question