Downloading: connection...Failed to download cartalyst/nested-sets from dist: - laravel-4

I'm having some problems with a package (cartalyst/nested-sets) on my local laravel application. My composer.json is valid as:
$ composer validate
./composer.json is valid
I have a copy of the nested-sets package files on my desktop and have included them in my project tree - so the files are present and paths are correct.
Here's a snapshot of my composer.json file:
"require": {
"cartalyst/nested-sets": "2.0.*"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.cartalyst.com"
}
],
...
I then issue:
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing cartalyst/nested-sets (v2.0.2)
Downloading: connection...Failed to download cartalyst/nested-sets from dist: The "https://api.github.com/repos/cartalyst/nested-sets/zipball/7a425710ece922556e55150f5a1f2dfbedd4ffaa" file could not be downloaded (HTTP/1.1 404 Not Found)
Now trying to download from source
- Installing cartalyst/nested-sets (v2.0.2)
Cloning 7a425710ece922556e55150f5a1f2dfbedd4ffaa
It then just hangs with a blinking cursor at the shell. PHP OpenSSL extension is installed on my local and switching the firewall off makes no difference.
From the shell:
Failed to download cartalyst/nested-sets from dist: file could not be downloaded (HTTP/1.1 404 Not Found) but the files are already there? I don't understand.

You encounter this problem because you have to subscribe to Cartalyst repositories so you can get full access of their ressources and products ( libraries , components , sources ).
When Composer is trying to fetch Cartalyst from donwload or accessing a repository , it will ask you a valid username / password , if you have paid for a subscription you will get a valid auth credentials that enable you to access the repository and donwload via composer the required component / library ...
please read the following : https://medium.com/#Cartalyst/boss-sheet-8019c5e07246

Related

Laravel package class not found

I have installed laravel packages on staging server and packages working fine. But when i take pull on staging server, it is showing me error that package class not found.
Steps I have followed to resolve issue
I have check in vendor folder as well as in config/app.php, but I got class declaration and package folder is there.
After this when I update composer, my issue get resolved.
Is there any other file which should i look for class defination?
Perform a composer update, then composer dump-autoload.
If the above doesn't solve the problem, change the classmap in your composer.json file such that it contains the project-relative path to your php files:
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"database/seeds/UserTableSeeder.php" //include the file with its path here
]},
and soon after, perform a composer dump-autoload, and it should work now

composer is not updateing dependancy with lumen

I am using php 5.6.12 version,
I have to compulsory use this version.
running command : composer update
it is showing me like below,
Loading composer repositories with package information
Updating dependencies (including require-dev)
It is showing this only this since long time, not updates any dependancy of my packages
my composer.json file package as below,
"require": {
"php": ">=5.5.9",
"laravel/lumen-framework": "5.2.*",
"vlucas/phpdotenv": "~2.2",
"google/apiclient": "^2.0",
"maatwebsite/excel": "~2.1.0",
"googleads/googleads-php-lib": "^32.1",
"aws/aws-sdk-php-laravel": "~3.0",
"baopham/dynamodb": "^4.11",
"laravelista/lumen-vendor-publish": "^2.1",
"jenssegers/mongodb": "3.2.*",
"php-imap/php-imap": "^3.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~5.0",
"mockery/mockery": "~0.9"
},
I have run composer update -vvv command , it gives me below error,
Reading ./composer.json
Loading config file ./composer.json
Checked CA file E:\xampp7\apache\bin\curl-ca-bundle.crt: valid
Executing command (E:\xampp563\htdocs\delrentals-dashboard-api): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: C:/Users/hetal.gohel/AppData/Roaming/Composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 1.7.2 (2018-08-16 16:57:12) with PHP 7.0.27 on Windows NT / 6.1
Loading composer repositories with package information
Downloading https://repo.packagist.org/packages.json
Writing C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/packages.json into cache
Updating dependencies (including require-dev)
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2013.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2014.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2015.json from cache
Downloading http://repo.packagist.org/p/provider-2016%2421f5855cc4abf8648b47c77d76fee501bfc9fd4d893d6a602e8c8dbd0c4ea0ff.json
Writing C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2016.json into cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2017.json from cache
Downloading http://repo.packagist.org/p/provider-2018-01%24ebbeedf5cdf822efb5bb90b0b147c964df3e11e74d453bbdb6b04b537c180a7e.json
Writing C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2018-01.json into cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2018-04.json from cache
Downloading http://repo.packagist.org/p/provider-2018-07%240016a26f1005f0fb0be2f409b3fc05dde3132eb7694bc50e386e2a6be4802ee6.json
Writing C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2018-07.json into cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2018-10.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-archived.json from cache
Downloading http://repo.packagist.org/p/provider-latest%242eb9ff7604840d5f7b019a1d5770e987526594ecf1528f5fe6b613654914d5c4.json
......
I have create composer.json file with empty object "{}"
in location C:\Users\hetal.gohel\AppData\Roaming\Composer
Loading config file ./composer.json
Checked CA file E:\xampp7\apache\bin\curl-ca-bundle.crt: valid
Executing command (E:\xampp563\htdocs\delrentals-dashboard-api): git branch --no-color --no-abbrev -v
Reading C:/Users/hetal.gohel/AppData/Roaming/Composer/composer.json
Loading config file C:/Users/hetal.gohel/AppData/Roaming/Composer/composer.json
Running 1.7.2 (2018-08-16 16:57:12) with PHP 7.0.27 on Windows NT / 6.1
Loading composer repositories with package information
Downloading https://repo.packagist.org/packages.json
Writing C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/packages.json into cache
Updating dependencies (including require-dev)
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2013.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2014.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2015.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2016.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2017.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2018-01.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2018-04.json from cache
Downloading http://repo.packagist.org/p/provider-2018-07%24456764a723221fb097b4ae41ef2ce7d91d1207de7b45ed8301c2e0bf1c55387e.json
Writing C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2018-07.json into cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-2018-10.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-archived.json from cache
Downloading http://repo.packagist.org/p/provider-latest%245fb6a563ef29d0728dfbcf5cc60a8e56619893d5635943fb610b74eb55281719.json
Writing C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/p-provider-latest.json into cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/provider-laravel$lumen.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/provider-laravel$lumen-framework.json from cache
Reading C:/Users/hetal.gohel/AppData/Local/Composer/repo/https---repo.packagist.org/provider-illuminate$auth.json from cache
.....
It gives still error
Ok let me summarize.
Create a composer.json file in C:/Users/hetal.gohel/AppData/Roaming/Composer/composer.json. Just fill it with an empty json object {}. And then run composer update -vvv to see the update process in detail. Just wait until it's done. If the update process takes too long may be you should add the package dependency one by one.

Configure composer to get data from packagist.org via https

When building files in an environment that blocks outbound http requests, I get an error like:
Updating dependencies (including require-dev)
The "http://packagist.org/p/provider-2013%ahash.json" file could not be downloaded: failed to open stream: Connection timed out
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Is there some way to instruct composer to use https connection to packagist?
I've experienced the issue with both 1.2.0 and 1.6.5 versions of composer.
You can either force composer to use https by:
composer config -g repo.packagist composer https://packagist.org
Or you could set in your composer.json file:
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
Source: issue #5656 on composer's github repository.

Composer autoload path not working

I have this script that use composer to setup the project but for some reasons does not work
<?php
include_once 'vendor/autoload.php';
use \LeagueWrap\Api;
$api = new Api($key = "somekey"); // Load up the API
$summoner = $api->summoner(); // Load up the summoner request object.
$bakasan = $summoner->info('bakasan'); // Get the information about this user.
$bakasan = $summoner->info(74602); // same thing as above, just to show that an id will wo$
echo $bakasan->summonerLevel; // 30
echo $bakasan->id; // 74602
echo $bakasan->name; // "bakasan"
echo $bakasan->profileIconId; // 24
echo $bakasan->revisionDate; // 1387391523000
echo $bakasan->revisionDateStr; // "12/18/2013 06:32 PM UTC"
?>
you can check here http://70.37.98.151/leaguewrap/tests/test2.php the error I get
Warning: include_once(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/leaguewrap/tests/test2.php on line 3
my composer.json is
{
"name": "paquettg/leaguewrap",
"type": "library",
"description": "A wrapper for the League of Legends API.",
"version": "0.6.2",
"keywords": ["League", "legends", "wrap", "api", "facade", "proxy"],
"homepage": "https://github.com/paquettg/leaguewrap",
"license": "MIT",
"authors": [
{
"name": "Gilles Paquette",
"email": "paquettg#gmail.com",
"homepage": "http://gillespaquette.ca"
}
],
"require": {
"php": ">=5.4",
"guzzlehttp/guzzle": "4.0.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"mockery/mockery": "0.8.*",
"satooshi/php-coveralls": "0.6.*"
},
"autoload": {
"psr-0": {
"LeagueWrap": "src/"
}
},
"minimum-stability": "dev"
}
and here folders tree
Your script cannot find the autoload file.
Including that file is like any other file: The path must be right, and which path is right depends on whether you are using an absolute path (unusual) or a relative path. Currently you are using a relative path.
Assuming your script is somewhere inside that src folder you showed, the path to the vendor/autoload.php must at least contain one ../ to go one directory level up - maybe more.
Seems like its the problem with your Composer Installation.
Follow these steps -
First make sure you have the Composer.json file created with all the dependencies.
Let's say you are creating a project, and you need a library that does logging. You decide to use monolog. In order to add it to your project, all you need to do is create a composer.json file which describes the project's dependencies.
{
"require": {
"monolog/monolog": "1.2.*"
}
}
Installation - Linux / Unix / OSX
Downloading the Composer Executable
There are in short, two ways to install Composer. Locally as part of your project, or globally as a system wide executable.
Locally
Installing Composer locally is a matter of just running the installer in your project directory:
curl -sS https://getcomposer.org/installer | php
Note: If the above fails for some reason, you can download the installer with php instead:
php -r "readfile('https://getcomposer.org/installer');" | php
The installer will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.
You can install Composer to a specific directory by using the --install-dir option and providing a target directory (it can be an absolute or relative path):
curl -sS https://getcomposer.org/installer | php -- --install-dir=bin
Globally
You can place this file anywhere you wish. If you put it in your PATH, you can access it globally. On unixy systems you can even make it executable and invoke it without php.
You can run these commands to easily access composer from anywhere on your system:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Note: If the above fails due to permissions, run the mv line again with sudo.
Note: In OSX Yosemite the /usr directory does not exist by default. If you receive the error "/usr/local/bin/composer: No such file or directory" then you must create /usr/local/bin/ manually before proceeding.
Then, just run composer in order to run Composer instead of php composer.phar.
Installation - Windows
Using the Installer
This is the easiest way to get Composer set up on your machine.
Download and run Composer-Setup.exe, it will install the latest Composer version and set up your PATH so that you can just call composer from any directory in your command line.
Note: Close your current terminal. Test usage with a new terminal: That is
important since the PATH only gets loaded when the terminal starts.
Manual Installation#
Change to a directory on your PATH and run the install snippet to download composer.phar:
C:\Users\username>cd C:\bin
C:\bin>php -r "readfile('https://getcomposer.org/installer');" | php
Note: If the above fails due to readfile, use the http url or enable php_openssl.dll in php.ini
Create a new composer.bat file alongside composer.phar:
C:\bin>echo #php "%~dp0composer.phar" %*>composer.bat
Close your current terminal. Test usage with a new terminal:
C:\Users\username>composer -V
Composer version 27d8904
Using Composer
We will now use Composer to install the dependencies of the project.
To resolve and download dependencies, run the install command:
php composer.phar install
If you did a global install and do not have the phar in that directory run this instead:
composer install
Following the example above, this will download monolog into
the vendor/monolog/monolog directory.
Autoloading
Besides downloading the library, Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process:
require 'vendor/autoload.php';
You can also try with below require form -
defined('__ROOT__') or define('__ROOT__', dirname(dirname(__FILE__)));
require_once implode(
    DIRECTORY_SEPARATOR, array(__ROOT__, 'vendor', 'autoload.php')
);

Setting up alias for master branch in composer

I am trying to package a module for use with composer. I have a valid composer file and I am able to install it with composer, but only when I specify that it should use dev releases (via the "#dev" version directive or minimum stability dev). I am having trouble packaging my repo so that it is seen as a master release.
I found a composer document about aliases that seems to be made for my case, but I cant get it working. Heres the relevant portion of my composer.json:
"extra": {
"branch-alias": {
"dev-master": "1.0"
}
}
Also for reference heres the require from my main projects composer file:
"require": {
"misterglass/kohana-twig" : "1.*"
},
And the actual error from composer is:
Problem 1
- The requested package misterglass/kohana-twig 1.* could not be found.
According to some helpful people on the #composer IRC channel, aliases are just to associate different versions to each other, and not to assign stability.
In order to for composer to consider it stable, you need to add a tag, which you can do on the command line or by creating a release in github.

Resources