I would like to use api-platform/api-platform in my flex-enabled symfony application. To do so, I run the following commands:
# creation of the flex-enable symfony application
composer create-project symfony/skeleton:3.3.* sf-flex
# installation of the api recip
composer req api
Unfortunately, I am getting this error message:
[InvalidArgumentException]
Could not find package api-platform/api-pack at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] []
To avoid that problem, I tried several solutions:
Solution 1
composer create-project symfony/skeleton:3.3.x-dev sf-flex
composer req api
SAME ERROR
Solution 2
composer create-project symfony/skeleton:3.3.x-dev sf-flex # a more recent version of symfony/skeleton
composer req --dev api
SAME ERROR
Solution 3
I tried to update the file composer.lock by changing that field as follows:
# "minimum-stability": "stable", # has been changed to to dev
"minimum-stability": "dev",
SAME ERROR
So, any proposal??
Thanks,
Based on this page, I just changed composer.json by adding this line:
"type": "project",
"license": "proprietary",
"minimum-stability": "dev", // the added line
"require": {
"php": "^7.1.3",
// ...
And the API recipe is installed without problems...
Related
I already have Composer and XAMPP installed.
But when I try to use composer create-project laravel/laravel example-app command to create a new project by using Composer directly I throws some errors
C:\Users\HP>composer create-project laravel/laravel example-app
Creating a "laravel/laravel" project at "./example-app"
Installing laravel/laravel (v9.1.10)
- Installing laravel/laravel (v9.1.10): Extracting archive
Created project in C:\Users\HP\example-app
In CreateProjectCommand.php line 497:
chdir(): No such file or directory (errno 2)
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package> [<directory> [<version>]]]
C:\Users\HP>
I have tried:
Reinstalling Composer
Changing folder where I want to create my project
Using the composer global require laravel/installer
I'm using Composer version 2.3.7 and PHP Version 8.1.6. Im trying to install laravel 9 and my XAMPP is version 3.3.0
Did you try this ?
composer self-update
Same issue
Or you should change your installation directory.
cd desktop
I am trying to implement language translation in my app using the following plugin vue-i18n
I am following this documentation
https://github.com/martinlindhe/laravel-vue-i18n-generator
When I run the following code
composer require martinlindhe/laravel-vue-i18n-generator
in root#d722309335cd:/var/www#
I get the following error
root#d722309335cd:/var/www# composer require martinlindhe/laravel-vue-i18n-generator
Do not run Composer as root/super user! See https://getcomposer.org/root for details
---Using version ^0.1.30 for martinlindhe/laravel-vue-i18n-generator
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
[UnexpectedValueException]
/var/www/vendor/composer does not exist and could not be created.
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
What am I missing ?
I have created custom basic Laravel package and i have uploaded it on my github account and also connected github repo to https://packagist.org .
My repository url is https://github.com/johnsmithamk/message.git
I want to install that package from github to new Laravel application on my local server.
I am using Laravel verson 5.5. Below is my composer.json code
Composer.json
{
"name": "johnsmithamk/message",
"description": "Sample Package in Vendor folder",
"type": "project",
"license": "0.1",
"authors": [
{
"name": "John Smith",
"email": "testing7672#gmail.com"
}
],
"minimum-stability": "dev",
"require": {
"Illuminate/support": "~5"
},
"autoload":{
"psr-4":{
"test\\message\\": "vendor/test/message/src/"
}
},
"extra": {
"laravel": {
"providers": [
"test\\message\\MessageServiceProvider"
]
}
}
}
After adding repository to Packagist it tells to use this command to install the packages:
composer create-project johnsmithamk/message
but after running above command i am getting following errors:
[InvalidArgumentException]
Could not find package johnsmithamk/message with stability stable.
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]
Could anyone suggest on how to install laravel package from github?
Please check the composer.json code and let me know whether i have made some mistakes or not.
You need to use
composer require johnsmithamk/message
instead of
composer create-project johnsmithamk/message
I have tested your repository to install into my project and it is not showing any of the issue you have mentioned.
require includes the package into your already existing project and create-project creates a new project as it says.
You could have a look on their differences:
https://stackoverflow.com/a/22944572/3887342
Edit:
Added your package to the project and got some error but that is due to your some codes in your composer.json like:
1.Need to remove this vcs type from the composer.json as we will use packagist.
"repositories": [
{
"type": "vcs",
"url": "https://github.com/johnsmithamk/message.git"
}
],
Have a look on some popular package's composer.json
https://github.com/cartalyst/sentinel/blob/2.0/composer.json
2.Uses the dev only and not master branch as there might be only dev branch for now but need to have a look on this.
"minimum-stability": "dev",
https://github.com/LaravelCollective/html/blob/5.5/composer.json#L52
My log doesn't show any error.
C:\xampp\htdocs\Platform>composer require johnsmithamk/message
Using version dev-master for johnsmithamk/message
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing johnsmithamk/message (dev-master 319a00d): Cloning 319a00d01b
Failed to download johnsmithamk/message from source: Failed to clone https://github.com/johnsmithamk/message.git, git was not found, check that it i
s installed and in your PATH env.
'git' is not recognized as an internal or external command,
operable program or batch file.
Now trying to download from dist
- Installing johnsmithamk/message (dev-master 319a00d): Downloading (100%)
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
The compiled services file has been removed.
I am trying to install abraham's twitteroauth library (https://github.com/abraham/twitteroauth) in laravel 5 using composer. Added the project in composer.json like this
"require": {
"laravel/framework": "5.0.*",
"php": ">=5.4.0",
"abraham/twitteroauth": "0.5.2"
},
when i run composer update I receive an error at the end
- Installing abraham/twitteroauth (0.5.2)
Loading from cache
Writing lock file
Generating autoload files
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output:
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]
any help is Welcome
This isn't a problem with the library you are installing.
When Laravel v5.0.16 was released the compiled script location was changed and an upgrade guide was released. The unfortunate problem is that by running a composer update you would have upgraded to 5.0.16 without knowing any of this, as such you need to open bootstrap/autoload.php and change the $compiledPath variable.
// Change the current variable to this instead
$compiledPath = __DIR__.'/../vendor/compiled.php';
This will get it working again for you.
I was following a tutorial on Lynda.com, and I am completely new to the composer/laravel scene. The tutorial told me to install the MCrypt libarary, which I did successfully from this package:
topicdesk.com/downloads/mcrypt/mcrypt-download
Composer seems to be successfully installed/running.
I then went ahead and opened terminal, and put in the following command:
composer create-project laravel/laravel first_app --prefer-dist
Which resulted in the following error:
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
create-project [-s|--stability="..."] [--prefer-source]
[--prefer-dist] [--repository-url="..."]
[--dev] [--no-dev] [--no-plugins]
[--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs]
[--no-install] [package] [directory] [version]
Any ideas on what the issue may be? After looking around on the forums, it seems to me that it is a very case specific issue. Where do I begin in finding what may be preventing it from working correctly?