Package not found from vcs repo - composer-php

I have forked a repo and created a branch called 3.0 that I would like to install to my project to test (not a longterm fork. I want to create a pull request after testing). I have added the following to my composer file:
"repositories": [{
"type": "vcs",
"url": "https://github.com/albertski/laravel-grid"
}],
When running composer show "albertski/laravel-grid" I get Package albertski/laravel-grid not found.
When I run composer require albertski/laravel-grid:3
.0-dev I get the following:
Could not find a matching version of package albertski/laravel-grid. Check
the package spelling, your version constraint and that the package is avail
able in a stability which matches your minimum-stability (dev).
Am I missing any steps? According to the docs that should be it. I am using Composer version 1.9.0.
This is my full composer.json file:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/browser-kit-testing": "^5.1",
"laravel/framework": "^6.0",
"laravel/tinker": "^1.0",
"laravel/ui": "^1.0"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"repositories": [{
"type": "vcs",
"url": "https://github.com/albertski/laravel-grid"
}],
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
},
"files": ["tests/utilities/functions.php"]
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Edit
Just to test it out I created a branch called 3.0_albert and updated the composer.json name field to "name": "albertski/laravel-grid",. (Not a fan of doing this because I eventually want to perform a pull request)
Then ran composer require albertski/laravel-grid:3.0_albert-dev but same issue.

I was able to figure it out. Instead of calling:
composer require albertski/laravel-grid:3.0.x-dev
You call:
composer require leantony/laravel-grid:3.0.x-dev
Basically by adding:
"repositories": [{
"type": "vcs",
"url": "https://github.com/albertski/laravel-grid"
}],
You are telling composer to check your repo first for the package instead of the default one.

Related

Cannot update laravel/passport

Actually Im trying to set API for my website on Laravel. I found that I need to add CreateFreshApiToken to Kernel.php in order to use it. Well, I wish could, but it doesn't exist. Then I have found I can get it via
composer require laravel/passport
I run it and have this one
composer require laravel/passport
./composer.json has been updated
Running composer update laravel/passport
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- artogrig/laravel-make-service[1.0.0, ..., 1.0.1] require illuminate/support ~5 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires artogrig/laravel-make-service ^1.0 -> satisfiable by artogrig/laravel-make-service[1.0.0, 1.0.1].
This is my comsposer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"artogrig/laravel-make-service": "^1.0",
"cviebrock/eloquent-sluggable": "^7.0",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "^2.5",
"laravel/framework": "^7.0",
"laravel/passport": "^4.0",
"laravel/socialite": "^3.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"tcg/voyager": "^1.4"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"repositories": {
"hooks": {
"type": "composer",
"url": "https://larapack.io"
}
}
}
I have no idea what to do with. Could someone help me, please!
Thanks!
The dependency artogrig/laravel-make-service only works with Illuminate\Support 5, for what this package does, create service classes and is unmaintained. I would simply just remove it and your dependencies would be fixed.

Upgrade Laravel project from 5.5 to latest version 8

I want to Upgrade my Laravel project from (5.5 to 8) what I will do for that.
I didn't found any documents to upgrade from 5.5 to 8 just upgrade from 5.5 to 5.6 or from 7 to 8 maybe must upgrade the project step by step from 5.5 to 5.6 the from 5.6 to 5.7 then .... nutil 8
Thanks
composer.json(Laravel 5.5):
{
"name": "HomFolio",
"description": "Smart Property Investing",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"ext-json": "*",
"barryvdh/laravel-dompdf": "^0.8.1",
"barryvdh/laravel-translation-manager": "dev-master",
"fideloper/proxy": "~3.3",
"intervention/image": "^2.4",
"joedixon/laravel-translation": "^1.1",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"stripe/stripe-php": "^4.7",
"zizaco/entrust": "dev-master"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"xethron/migrations-generator": "^2.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
composer.json (Laravel 8):
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Looks like upgrades are sequential. As of today, I have a laravel 5.7 project that I have to upgrade to Laravel 8 and this looks like the sequence I need to take.
Even when you opt for the highly recommended Laravel Shift, you have to pay for each upgrade as indicated in the picture below.
.
If you have budget, laravel shift looks like a quick and easy way to go through the upgrade(s)
You have to follow the steps given below:
Copy the your current composer.json file.
Now go here https://github.com/laravel-shift/laravel-8.x/blob/master/composer.json and copy composer.json file and replace with your existing composer.json file.
Again go to https://github.com/laravel-shift/laravel-8.x/blob/master/app/Exceptions/Handler.php and copy the Handler.php file and go to app/exceptions/Handler.php replace Handler.php with your existing file.
Run the command composer update.
Check your old or your copied composer.json file and if packages have been added to it then you can add packages through this command composer require <package name>.
Now, again run composer update command.
You going to have to upgrade iteratively I'm afraid.
If you have the budget, you can use a service like Laravel Shift
to automate the upgrade.
Adding to some missing steps to #Krina Mangukiya
/bootstrap/environment.php :
$dotenv = Dotenv\Dotenv::createImmutable(DIR.'/..');
$dotenv->load();
The report and render methods of your application's
App\Exceptions\Handler class should accept instances of the Throwable
interface instead of Exception instances:
use Throwable;
public function report(Throwable $exception); public function
render($request, Throwable $exception);
This answers have taken from stackoverflow only but would be go to have all issue answers in one place.

Composer doens't update 'laravel/framework' package

I'm trying to update my composer dependencies as I'm experiencing a weird error that in my Debug Pages I get the Symfony Page but not the Laravel one. As I tried to update my composer packages I saw that composer doens't even updates the laravel/framework package.
Composer output
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Package manifest generated successfully.
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
39 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
"ext-json": "*"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
I'm using Plesk and can't access SSH.

composer local package refuses to grab from local path

I am trying to modify an existing composer package.
I forked the original package from github, cloned it on my local machine and now trying to make my laravel app use it with the following composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": "5.6.*",
....
"vendor/packagenamehere": "dev-dynamic-logo",
....
},
"minimum-stability": "dev",
"repositories": [
{
"type": "composer",
"url": "https://www.setasign.com/downloads/"
},
{
"type": "path",
"url": "path/to/package/on/my/machine",
"options": {
"symlink": true
}
}
],
"require-dev": {
"fzaninotto/faker": "~1.4",
"laravel/dusk": "^1.0",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7",
"staudenmeir/dusk-updater": "^1.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Helpers/env.php",
....
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
Then im firing composer update vendor/packagename --prefer-dist - and nothing.
No matter what I try, composer still grabs from packagist.
Any ideas?
From https://getcomposer.org/doc/05-repositories.md#path :
If the package is a local VCS repository, the version may be inferred by the branch or tag that is currently checked out. Otherwise, the version should be explicitly defined in the package's composer.json file. If the version cannot be resolved by these means, it is assumed to be dev-master.
Make sure that the "dynamic-logo" branch is checked out in your cloned package repo or update the version in the composer.json of the package.
Also check that the name of the package declared in it's composer.json matches your "vendor/packagename".

laravel package development - develop multiple packages that depend on eachother

I am trying to setup up a development environment for my previously developed packages which depend on eachother. I could setup laravel and a packages directory in which I cloned all the packages into. But now when I add them to laravel composer.json file and run composer update I run in the following error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for tjventurini/sunshine dev-master -> satisfiable by tjventurini/sunshine[dev-master].
- tjventurini/sunshine dev-master requires tjventurini/articles ^0.1.8 -> satisfiable by tjventurini/articles[v0.1.8] but these conflict with your requirements or minimum-stability.
Problem 2
- tjventurini/articles dev-master requires tjventurini/tags ^0.0.9 -> satisfiable by tjventurini/tags[v0.0.9] but these conflict with your requirements or minimum-stability.
- tjventurini/articles dev-master requires tjventurini/tags ^0.0.9 -> satisfiable by tjventurini/tags[v0.0.9] but these conflict with your requirements or minimum-stability.
- Installation request for tjventurini/articles dev-master -> satisfiable by tjventurini/articles[dev-master].
This is how my laravel composer.json file looks like:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"minimum-stability": "dev",
"prefer-stable" : true,
"repositories": [
{
"type": "path",
"url": "packages/sunshine"
},
{
"type": "path",
"url": "packages/articles"
},
{
"type": "path",
"url": "packages/portfolio"
},
{
"type": "path",
"url": "packages/tags"
},
{
"type": "path",
"url": "packages/mini-bootstrap-theme"
},
{
"type": "path",
"url": "packages/contact"
}
],
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"tjventurini/mini-bootstrap-theme": "dev-master",
"tjventurini/tags": "dev-master",
"tjventurini/articles": "dev-master",
"tjventurini/portfolio": "dev-master",
"tjventurini/contact": "dev-master",
"tjventurini/sunshine": "dev-master"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"symfony/thanks": "^1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
composer did manage to create symlinks in the vendor directory for the tags and mini-bootstrap-theme packages before I added the other packages.
Also I already added the minimum-stability setting already.
Thank you!
Thanks to the comment of #Norman-N I could find an Answer very quickly. As he pointed out, I had to use aliases to use dev-master as a specific version/tag.
Here is a link to the composer documentation
I changed my composer.json as shown below.
"tjventurini/articles": "dev-master as 0.1.8",
"tjventurini/contact": "dev-master as 0.0.9",
"tjventurini/mini-bootstrap-theme": "dev-master as 0.0.3",
"tjventurini/portfolio": "dev-master as 0.0.17",
"tjventurini/sunshine": "dev-master as 0.2.10",
"tjventurini/tags": "dev-master as 0.0.9"

Resources