Here is my composer.json:
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.5",
"zendframework/zendframework": "~2.5",
"facebook/php-sdk-v4" : "~5.0",
"kbariotis/feedly-api": "dev-master"
}
}
I want to run composer update but I don't want to update ZF2, just other dependencies.
If you want only a specific version to be installed see the documentation for exact If you specify the exact version you require it cannot attempt to upgrade your version of the package which "~2.5" suggests to composer is what you want to happen
So you could use for example
"require": {
"php": ">=5.5",
"zendframework/zendframework": "2.5.3",
"facebook/php-sdk-v4" : "~5.0",
"kbariotis/feedly-api": "dev-master"
}
See the documentation for EXACT
With this you can run composer update and it should not attempt to upgrade the ZF Framework
You need to run
composer update facebook/php-sdk-v4 kbariotis/feedly-api
instead.
Related
I am trying to install the asana library through the composer.
Json:
"asana/asana": "^0.10.0" added to composer.json and {
"name": "asana/asana",
"description": "A PHP client for the Asana API",
"type": "library",
"keywords": ["asana", "client"],
"homepage": "https://github.com/Asana/php-asana",
"license": "MIT",
"require": {
"php": ">=5.4.0",
"nategood/httpful": "~0.2",
"adoy/oauth2": "^1.2.0"
},
"require-dev": {
"instaclick/php-code-sniffer": "dev-master",
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-0": {
"Asana\\": "src/"
}
}
}
to composer.lock but getting error 'Package Asana/asana has no version defined.
'
As suggested by #Jeto you should not edit composer.lock manually. To install the library, you can follow the steps mentioned in official docs here.
Assuming that you are doing a fresh install, follow steps below:
Put "asana/asana" package as a dependency in your composer.json file:
{
"require": {
"asana/asana": "^0.10.0"
}
}
Now run the command composer install
composer.lock file will be automatically updated by Composer when installation succeed.
EDIT:
OR
As mentioned by #Jeto in comments, You can simply do this using a single command: composer require asana/asana:^0.10.0
I created a package and here is it's composer.json:
{
"name": "faustuzas/theme-downloader",
"description": "Easy to use bootstrap theme downloader",
"type": "command",
"require": {
"php": ">=5.6.0",
"guzzlehttp/guzzle": "^6.3"
},
"license": "MIT",
"authors": [
{
"name": "Faustas Butkus",
"email": "faustas.butkus#gmail.com"
}
],
"minimum-stability": "stable"
}
but when I try to require it via composer:
composer require faustuzas/theme-downloader
I get this error:
Where is the problem?
There's no need to use "minimum-stability": "stable" because it's set to 'stable' by default. You have one branch and no tags so packagist show your package as dev-master which isn't stable. Try to create new branch e.g. 1.x and add tag e.g. 1.0.0 then composer require again.
I'm new to PHP Laravel. I've added a package using composer: composer require djchen/oauth2-fitbit. It seems that my composer.json did not update the autoloader as i keep getting the following error:
Fatal error: Class 'djchen\OAuth2\Client\Provider\Fitbit' not found in xxx on line 5.
this is what line 5 looks like:
use djchen\OAuth2\Client\Provider\Fitbit;
$provider = new Fitbit([ // line 5
Here is my composer.json (necessary bits)
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "vcs",
"require": {
"php": ">=5.6.4",
"djchen/oauth2-fitbit": "^1.0",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/",
"djchen\\OAuth2\\Client\\": "src/" // added manually - still does not work
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/",
}
},
I've done my research and i've tried composer install, composer update and composer dump-autoload. None of these worked. Any help would be appreciated.
Let's go with the nuclear solution here, your autoload file probably is cached somewhere.
Run following commands:
php artisan clear-compiled
php artisan cache:clear
php artisan config:clear
php artisan optimize
If this doesn't work, try to manually delete all autoload files you can find and run a composer update.
Answering my own question..
I probably should have really emphasised the fact that I'm new to Laravel. I managed to get around this by simply including the autoloader:
include('vendor/autoload.php');
And also calling composer dump-autoload afterwards.
Just pushed a package to packagist:
composer require rokfor/rokfor-slim:dev-master
It's returning the error
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for rokfor/rokfor-slim
dev-master -> satisfiable by rokfor/rokfor-slim[dev-master].
- rokfor/rokfor-slim dev-master requires
jlndk/slim-jade ^1.0 -> no matching package found.
If I'm checking out like
$ git clone https://github.com/rokfor/rokfor-slim
$ cd rokfor-slim
$ composer install
Everything installs just fine.
I think I'm missing something crucial here. Is it not allowed to push a package to packagist with a source from a vcs repository?
The composer.json looks like:
{
"name": "rokfor/rokfor-slim",
"description": "Rokfor CMS: Headless CMS with JSON api",
"keywords": ["rokfor", "slim","framework","view","template","jade"],
"homepage": "http://cloud.rokfor.ch",
"license": "MIT",
"type": "project",
"time": "2016-02-28",
"authors": [
{
"name": "Rokfor",
"homepage": "http://www.rokfor.ch"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/urshofer/slim-jade"
},
{
"type": "vcs",
"url": "https://github.com/Rokfor/rokfor-php-db"
},
{
"type": "vcs",
"url": "https://github.com/urshofer/slim-auth"
}
],
"require": {
"php": ">=5.5.0",
"slim/slim": "~3.0",
"jlndk/slim-jade": "^1.0",
"rokfor/db": "dev-versioning",
"monolog/monolog": "^1.17",
"slim/csrf": "^0.6.0",
"jeremykendall/slim-auth": "dev-slim-3.x",
"slim/flash": "^0.1.0",
"akrabat/rka-ip-address-middleware": "^0.4.0",
"palanik/corsslim": "dev-slim3",
"erusev/parsedown": "^1.6",
"predis/predis": "^1.0",
"lcobucci/jwt": "^3.1",
"ext-gd": "*"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"minimum-stability": "dev",
"prefer-stable": true
}
In a library, you cannot reference anything other than libraries that are available on packagist.org. Or you instruct your users to reference an additional source for package information.
Adding vcs and package repositories is only allowed for the root composer.json, which you cannot influence as a library other than instructing your users to do additional things beyond composer require your/lib. Which is kind of annoying, and also may be subject to security considerations, because this will not only open the door for your individual library, but for ANY library as well.
And as you did with "jlndk/slim-jade" (which the original author published from his repository as 0.0.1, and another author re-published it without adding it to packagist or changing the lib's name, adding the version tag 1.0), any additional source of package information can potentially add more package information, i.e. add a newer, malicious version of e.g. a symfony package.
I am trying to use Mandrill to send emails via my Laravel framework, however I am receiving the following error:
FatalErrorException in MandrillTransport.php line 114: Class
'GuzzleHttp\Client' not found
I have installed Guzzle using the following command in Terminal:
"guzzlehttp/guzzle": "~4.0"
According to Laravel's documentation I need to add "guzzlehttp/guzzle": "~4.0" to my composer.json file, but I'm not sure if where I have placed it is correct as I still see the error.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "^5.0",
"guzzlehttp/guzzle": "~4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"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-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
Here is the list of packages my application has, notice that guzzle has a different version: 4.2.3 which i've also tried updating to but still get the same error.
Open up your terminal at the root of your project and enter
composer require guzzlehttp/guzzle
It worked for the mailgun API. For some reason, the suggested method at the laravel's mail doc. You may install this package to your project by adding the following line to your composer.json file
"guzzlehttp/guzzle": "~5.3|~6.0"
doesn't make the composer download the Guzzle source codes. By the way, I didn't find out what | means in determining the version. This command just downloads the PSR code.
In this moment, the solution may work. However, be aware of compatibility issues. Because the command would install the latest stable version, not the suitable one.
If you're using Laravel when you run into this error, just run:
composer require guzzlehttp/guzzle
And try again.
After updating your composer.json file you need to run the update command to resolve and install your dependencies:
composer update
or, if composer isn't in your path:
php composer.phar update
Did you try :
artisan clear-compiled
or if artisan is not available try to remove compiled.php if exist (in vendor directory) and launch composer dumpautoload
I had the same issue.
I used an old version in order to work.
It's not working anymore since version 4.
It works on version 3.8.1
So you can add "guzzlehttp/guzzle": "~3" to works
simple in my case add "guzzlehttp/guzzle": "^6.3" in composer.json
require object as mentioned below
"require": {
"php": ">=7.0.0",
"ext-gd": "*",
"barryvdh/laravel-cors": "^0.11.2",
"barryvdh/laravel-dompdf": "^0.8.1",
"dingo/api": "2.0.0-alpha1",
"doctrine/dbal": "^2.6",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "^2.4",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"league/flysystem-aws-s3-v3": "~1.0",
"predis/predis": "^1.1",
"tymon/jwt-auth": "dev-develop"
},
than run composer update in project root using terminal than its working fine.
I am oblivious to why this worked for me, I saw this in a forum somewhere
I just added this captcha generator to the composer.json file
"mews/captcha": "~2.0.",
added it to all the require package
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"laravelcollective/html": "5.1.*",
"laracasts/flash": "~1.3",
"mews/captcha": "~2.0.",
"guzzlehttp/guzzle": "~4.0"
},
If someone knows why this worked it would really scratch the itch in my brain.
I got this error when I tried running my code outside of the Laravel framework while testing in a stand alone file. It worked for me when I moved it inside a controller.
You can solve this problem to add "mews/captcha": "1.0.1" and "guzzlehttp/guzzle": "~4.0" to your composer.json file. And then you need run composer update command on your terminal.
I have tried on Laravel 4. It works for me.
Try updating your composer to latest version might end sorting your problem. This worked out for me. Ubuntu/Linux users use this tutorial in Digital ocean