I'm trying to add the "cedarmaps-php-sdk" composer package to my Laravel project
the package can be found here: https://github.com/cedarstudios/cedarmaps-php-sdk
I have successfully installed the package using
composer install
&
composer update
The problem is when I want to use the 'CedarMaps' I get the error:
"main(): Failed opening required 'vendor/autoload.php' (include_path='C:\xampp\php\PEAR')" *image
for now, I'have manually bypassed this problem by changing
require('vendor/autoload.php');
to
require('../vendor/autoload.php');
in the below file (the repository file)
vendor/cedarmaps/cedarmaps-php-sdk/src/CedarMaps.php
am I doing anything wrong?
+++++++++++++++++++++++++++++++++
Let me ask a question: Was that necessary for this package to require autoload.php itself
, I mean doesn't composer handle this autoloading for all packages automatically?
You need to use composer require 'package name' to install a package to your existing project then do a composer dump-autoload.
Related
I'm trying to use https://github.com/consolibyte/quickbooks-php in a Drupal 8 project. I think I've followed composer ways of adding it:
composer config repositories.quickbooks-php vcs https://github.com/consolibyte/quickbooks-php
composer require "consolibyte/quickbooks-php master"
But the 2nd command returns "Could not find package consolibyte/quickbooks-php".
Any ideas what I'm doing wrong?
You're using incorrect package name - real package name is defined in composer.json of this package and it is consolibyte/quickbooks instead of consolibyte/quickbooks-php.
composer require "consolibyte/quickbooks:dev-master"
Also this package is registered at Packagist, so you don't need to add repository for it. See https://packagist.org/packages/consolibyte/quickbooks
I'm trying to install my first composer package which I have built for learning.
For that, I have successfully setup Github repository and packagist account:
https://github.com/xparthx/Composer-package-demo
https://packagist.org/packages/xparthxvorax/demo
The issue is when I'm trying to install it using composer require xparthxvorax/demo, it gives me following error:
[UnexpectedValueException]
Error while installing xparthxvorax/demo, composer-plugin packages should have a class defined in their extra key to be usable.
I think the issue is with the package type. As per this doc, the default package type should be library:
https://getcomposer.org/doc/04-schema.md#type
Create a new tag, because with composer require composer will try to install latest tag, which in your case is the one with "composer-plugin" type: https://github.com/xparthx/Composer-package-demo/blob/v1/composer.json
I am trying to install package library by composer in YII2. But after running the command from my command prompt I am getting following error
My composer command is
composer.phar require kartik-v/yii2-widget-datetimepicker "*"
Package yiisoft/yii2-codeception is abandoned, you should avoid using it. Use codeception/codeception instead.
When installing by this command
php composer.phar require kartik-v/yii2-social "#dev"
Then I am getting following error
Package facebook/php-sdk-v4 is abandoned, you should avoid using it. Use facebook/graph-sdk instead.
Generating autoload files
Please suggest me how can I resolve this error
This is not an error. This is just an information for you from composer that one of the required packages has been abandoned and you should not expect to get updates for it.
If you want to get rid of this information simply remove the mentioned packages from the composer.json file of your project.
If the package is not listed there it means that one of the required packages listed needs it as dependency so you can not remove it directly.
As for the Yii 2 - here is the current advanced project template's composer.json so you can update the one in your project - package yiisoft/yii2-codeception is no longer used.
When I run composer update, I get the following error:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Illuminate\Foundation\ComposerScripts::postUpdate
php artisan optimize
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Laravel\Cashier\CashierServiceProvider' not found
Script php artisan optimize handling the post-update-cmd event returned with err
or code 255
I put this code on the app.php file
Laravel\Cashier\CashierServiceProvider::class,
and in the composer.json I also put this
"laravel/cashier": "~6.0"
like in the laravel doc
stack errot
Remove the
Laravel\Cashier\CashierServiceProvider::class,
from app.php.
It needs to be added after installing the package.
Also, instead of composer update, try composer require without changing the composer.json file.
composer require laravel/cashier
Don't add anything in composer.json file or app.php.
Just follow the documentation given in Laravel website for Laravel Cashier, (select the laravel version which you are using in your project).
Run the commands in following order:
//install the package and add it in composer file
composer require laravel/cashier
//add your cashier class in 'providers' array in app.php
Laravel\Cashier\CashierServiceProvider::class,
//add alias in 'aliases' array in app.php
'Cashier' => Laravel\Cashier\CashierServiceProvider::class,
//will add several columns to users table & create a new subscriptions table
php artisan migrate
Check the php version in cmd useing php -v
if php version is < 7.0 then install latest version of php.
Uninstall the old verion Xampp
Install latest version of Xampp to upgrade php.
i'm trying to install the anahkiasen/former package once again but it won't work. The funny thing is, I downloaded it about a weak ago and it was working perfectly. My code if finished and use's this former package. I tried to install a new package a half hour ago and since this the former class isn't found anymore.
Like I mentioned it, it was working perfectly before, but since I did a composer update it doesn't work.
Well I did what they said over here:
https://github.com/formers/former/wiki/Getting-started
first I run this::
composer require anahkiasen/former:4.0.*#dev
then a composer update
after the update I add this in my config/app.php provider section:
Former\FormerServiceProvider::class,
and this in the alias section:
'Former' => 'Former\Facades\Former',
I tried it but it still doesn't work. Just getting
Class 'Former\FormerServiceProvider' not found
as an output
I removed the package I wanted to install before and found another way.. But the problem with the former class is still there.
Thanks for any help!
Terminal outputs:
/var/www/laravel# php composer.phar require anahkiasen/former
gives:
Using version ^4.0 for anahkiasen/former
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
-------- then I added the provider/alias --- after this:
composer update --no-scripts
gives
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
composer dump-autoload
gives of course:
Generating autoload files
/var/www/laravel/logs# php artisan config:publish anahkiasen/former
gives:
PHP Fatal error: Class 'Former\FormerServiceProvider' not found in /var/www/laravel/logs/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Former\FormerServiceProvider' not found
note that I changed the directory in the last command
Let's start from the beginning.
Follow below steps:-
1) Run below command in terminal:-
composer.phar require anahkiasen/former
2) It'll ask you for the version, type dev-master
3) Add Former's service provider to your Laravel application in app/config/app.php. In the providers array add :
'Former\FormerServiceProvider',
Add then alias Former's main class by adding its facade to the aliases array in the same file :
'Former' => 'Former\Facades\Former',
4) run composer update --no-scripts
After that, run composer dump-autoload, and that should work.
If not working then run this command:-
php artisan config:publish anahkiasen/former
Hope it will help you :)