Dependencies not picked up after composer update/install - php

I am using the following image in my deploy script
image: php:7-fpm
and then do some typical stuff to install my composer dependencies:
script:
- apt-get update && apt-get install -y unzip python-dev git
- apt-get install -qy git curl libmcrypt-dev mysql-client
- docker-php-ext-install mcrypt && docker-php-ext-install pdo_mysql
- apt-get install -y curl software-properties-common gnupg
- ./install-composer.sh
- composer install
Issue is that while I see in the console the packages being installed, when I login to the server and go to the vendor dir then the new package (aws-sdk-php) is not in there.
Installing aws/aws-sdk-php (dev-master 86d1892): 100%
What goes wrong here?
Update
This is my composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.1.3",
"fideloper/proxy": "~4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "~1.0",
"aws/aws-sdk-php": "dev-master"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"nunomaduro/collision": "~2.0",
"phpunit/phpunit": "~7.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
},
"minimum-stability": "dev",
"prefer-stable": true
}

Hey dont know much about the aws thing but you are trying to load the php package for the awsin laravel. Though laravel is a framework for php but the aws package gives special package for laravel. This is the package "aws/aws-sdk-php": "dev-master" you stated in your composer.json.
Instead include this "aws/aws-sdk-php-laravel": "~3.0" package into your composer.json. This is specially crafted for laravel. After including run composer update and see if the package gets included in the vendor directory or not.
Link of respected package at packagist.
Link of respected package at GitHub.
Hope it helps.

Related

Can't make "composer require laravel/ui --dev" on laravel 6.5.1

I am getting following error :
Can't make "composer require laravel/ui --dev" on laravel 6.5.1. I get an error
"Your requirements could not be resolved to an installable set of packages.
Problem 1:
Conclusion: remove laravel/framework v6.5.1
Conclusion: don't install laravel/framework v6.5.1
Installation failed, reverting ./composer.json to its original content.
In my composer.json
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.2.0",
"tcg/voyager": "^1.3"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"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"
}
}
}
Php version 7.2.25
Please, help.
Version 2 of laravel/ui isn't compatible with version 6 of Laravel so installs the version 1 with composer require laravel/ui="1.*" --dev
The command to implement Auth is as follows:
composer require laravel/ui
php artisan ui vue --auth
OR
composer require laravel/ui --dev
php artisan ui vue --auth
If your Login and Register page only shows plain HTML. And CSS is not loading properly then run this two command:
npm install
npm run dev
Try this command, it worked for me:
$ composer require laravel/ui "^1.2"
composer require laravel/ui "^1.2" works...laravel 6 versions can only run
laravel/ui 1.2.0:
See Packagist for older versions
https://packagist.org/packages/laravel/ui#v1.2.0. ----------------------
Also check out laravel 6 docs
https://laravel.com/docs/6.x/frontend -----------------------
I faced the same issue with laravel 6.17. You can try to use this command instead :
composer require laravel/ui="1.*" - -dev
In my conclusion that laravel 6.x not compatible with laravel/ui version ^2.0. That command works for me.

Laravel not installing require-dev packages of Laravel distro package

I have created a Laravel distro package with all Laravel packages that all of my websites use.
I've also created a custom Laravel-website that uses this distro package.
Unfortunately when I run composer install --dev on the 2nd composer file, it won't install the require-dev packages from the laravel-distro composer package, e.g. phpunit/phpunit
Laravel-distro composer configuration:
$ cat laravel-distro/composer.json
{
"name": "dennis00/laravel-distro",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"laravel/installer": "^2.0.1"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"vendor-dir": "vendor",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"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"
]
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
Laravel-example composer configuration:
$ cat laravel-example/composer.json
{
"name": "dennis00/laravel-example",
"description": "Example of Laravel Distro",
"type": "project",
"license": "GPL-2.0+",
"minimum-stability": "dev",
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"autoload": {
"classmap": [
"scripts/composer/ScriptHandler.php"
]
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"require": {
"dennis00/laravel-distro": "dev-master#dev",
"laravel/horizon": "^4.0#dev"
}
}
You can see the require-dev packages are missing here.
root#f506ece6f4ea:/var/www/html# ls vendor
autoload.php cakephp dennis00 doctrine egulias fideloper jakub-onderka laravel monolog nette ocramius paragonie phpstan psy ramsey symfony vlucas
bin composer dnoegel dragonmantank erusev guzzlehttp jean85 league nesbot nikic opis phpoption psr ralouphie swiftmailer tijsverkoyen
root#f506ece6f4ea:/var/www/html# ls vendor_backup/
autoload.php bin dnoegel dragonmantank erusev filp hamcrest laravel mockery myclabs nikic opis phar-io phpoption phpunit psy sebastian symfony tijsverkoyen webmozart
beyondcode composer doctrine egulias fideloper fzaninotto jakub-onderka league monolog nesbot nunomaduro paragonie phpdocumentor phpspec psr ramsey swiftmailer theseer vlucas
root#f506ece6f4ea:/var/www/html#
It won't, this is intentional.
As the packages are in the require-dev section of the first base package.json file, this will only be installed if you are running composer install on that package.
As you are pulling that package into another project, composer will only install those dependencies from the package that are not within require-dev.
This is because require-dev is only for the development of that package and should not be required to use the package in something else. If you need these packages to be installed when you are using your base package, then you must put them in require and not require-dev.

Laravel Update / install composer package

Can you answer me?
I use the latest version of Laravel and I want to add to my project the PayPal service.
I want to install some package to Laravel and added this 2 rows to composer.json
"guzzlehttp/guzzle": "~5.2",
"paypal/rest-api-sdk-php": "*"
My composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.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": [
"/usr/local/bin/php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"/usr/local/bin/php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"/usr/local/bin/php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true,
"cache-dir": "/home/iamdevco/public_html/norrisms/designer/cache"
},
"guzzlehttp/guzzle": "~5.2",
"paypal/rest-api-sdk-php": "*"
}
but I get this error after download packages
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
/usr/local/bin/php artisan package:discover
The system cannot find the path specified.
Script /usr/local/bin/php artisan package:discover handling the post-autoload-dump event returned with error code 1
after you install all packages run
composer dumpautoload
packages
composer require guzzlehttp/guzzle-services
composer require paypal/rest-api-sdk-php
composer dumpautoload
Rather than manually writing the composer.json, try installing and adding them with the specific commands. Like this.
composer require paypal/rest-api-sdk-php
composer require guzzlehttp/guzzle
That way, you'll avoid any typos and composer.json file will be kept as pure as possible.
Try this composer require paypal/rest-api-sdk-php
Ref: https://packagist.org/packages/paypal/rest-api-sdk-php
Edit:
remove the paypal/rest-api-sdk-php on the composer.json and the guzzle then try this
composer require guzzlehttp/guzzle

Composer hangs on "Resolving dependencies on SAT" between Moodle and Laravel used as a local plugin

I'm using a Laravel project as a local plugin of Moodle, using the composer/installer package. The layout of the project is:
// Moodle Application
- composer.json
- local/
- laravel-plugin/ <- here is the Laravel local plugin
- composer.json <- composer.json of Laravel plugin
The composer.json of the Moodle application
{
"name": "moodle/moodle",
"license": "GPL-3.0",
"description": "Moodle - the world's open source learning platform",
"type": "project",
"homepage": "https://moodle.org",
"require": {
"composer/installers": "~1.0",
"Pursuittech/sam": "dev-master" <- here is the Laravel local plugin
},
"require-dev": {
"phpunit/phpunit": "5.5.*",
"phpunit/dbUnit": "1.4.*",
"moodlehq/behat-extension": "3.33.1",
"mikey179/vfsStream": "^1.6"
},
"repositories": [
{
"type": "vcs",
"url": "git#github.com:Pursuittech/sam.git"
}
]
}
composer.json of the Laravel local plugin
{
"name": "Pursuittech/sam",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "moodle-local",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"composer/installers": "~1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"Api\\": "api/",
"App\\": "app/"
}
},
"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
}
}
When I try to install the Laravel plugin using php composer.phar -vvv update, I hang on "Resolving dependencies through SAT".
I found a similar question which has the problem when only dealing with Laravel 4.2 in isolation. I haven't been through everything in the list and will update when I have.
My question is, is it normal for "Resolving dependencies through SAT" to hang when combining large composer projects like Laravel and Moodle? Are there any immediate steps I can take to reduce the complexity of the problem?
try those steps maybe you will get more reasonable output, its probably conflict of package version (eg. one of the packages locked on version which does not satisfy other package)
try no-dev option first
composer update --no-dev -vvv
try updating package by package
composer update some/package --no-dev -vvv
try to delete vendor folder and composer.lock
finally check composer.json of each package and compare requirements search for versions which exclude themselves from working together

How to install Jaxon 2.0 in Laravel 5.3

Good day.
I followed the tutorial instruccions to install.
Installation
Add the following lines in the composer.json file, and run the composer update command.
"require": {
"jaxon-php/jaxon-laravel": "~2.0"
}
But i recieve the following error:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package jaxon-php/jaxon-laravel ~2.0 is satisfiable by jaxon-php/jaxon-laravel[v2.0-beta.1, v2.0-beta.2, v2.0-beta.3, v2.0-beta.4, v2.0-beta.5, v2.0-beta.6] but these conflict with your requirements or minimum-stability.
This is my composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"laravelcollective/html": "^5.3.0",
"yajra/laravel-datatables-oracle": "^6.20",
"elibyy/tcpdf-laravel": "5.3.*",
"iatstuti/laravel-nullable-fields": "~1.0",
"orangehill/iseed": "2.2",
"jaxon-php/jaxon-laravel": "~2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"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"
}
}
Any ideas? Thank you.
Googling arround i think i found my problem:
Since jaxon is in BETA version and composer default minimun stability requeriments are STABLE, composer failed to install the package.
I added this 2 lines to my composer.json:
"minimum-stability": "beta",
"prefer-stable": true,
Source:
http://webtips.krajee.com/setting-composer-minimum-stability-application/
https://getcomposer.org/doc/04-schema.md#minimum-stability

Categories