Composer Paysafe any version? - laravel

First time I try to add a package in the composer.json of my laravel application.
I trying to add this package paysafe https://github.com/paysafegroup/paysafe_sdk_php
I downloaded the repo and moved it under the folder "vendor" in laravel
It seem that I need to specific the version of the package I am trying to install , but I don't have this information ...
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "4.2.*",
"barryvdh/laravel-dompdf": "0.4.*",
"mailgun/mailgun-php": "~1.7.2",
"guzzlehttp/guzzle": "~4.0",
"mikehaertl/phpwkhtmltopdf": "^2.0",
"paysafe":"*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/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 artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}
When I run this command
php composer.phar require paysafe
I get this error message:
[InvalidArgumentException]
Could not find package paysafe at any version for your minimum-stability (dev). Check the package spelli
ng or your minimum-stability

We have recently updated the SDK which should have fixed the version conflict issue. Please use PHP SDK version 1.0.1 and give it another shot!
All the best!

Related

Composer --> Package listed for update is not installed, ignoring

I am using Laravel 5.1 and trying to install a new package via composer. I am using following command.
composer require "matriphe/imageupload:5.1.*"
I am getting following error.
./composer.json has been updated
> php artisan clear-compiled
Package "matriphe/imageupload" listed for update is not installed. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> php artisan optimize
Generating optimized class loader
I also tried running
composer self-update
This is the message I received.
You are already using composer version f1aa655e6113e0efa979b8b09d7951a762eaa04c.
I have also tried updating composer dependencies for project via manually adding package name to composer.json and running.
composer update
and
partially updating via.
composer update "matriphe/imageupload:5.1.*"
Up until now I have installed other packages and all of them were installed except this one.
For me, it was simply a typo in the package name.
Update: I solved the issue in the most bizzare way possible.
I initially had following composer.json file when I ran the command
composer require "matriphe/imageupload:5.1.*"
and
composer require laravelcollective/html:~5.0
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"matriphe/imageupload": "5.1.*",
"laravelcollective/html": "~5.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"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"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
And got the error.
Package "matriphe/imageupload" listed for update is not installed. Ignoring.
and
Package "laravelcollective/html" listed for update is not installed. Ignoring
To solve it I manually added another require array in json added packages to be installed which is given below.
"require": {
"laravelcollective/html": "~5.0",
"matriphe/imageupload": "5.1.*"
}
My modified composer.json file look like this.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*"
},
"require": {
"laravelcollective/html": "~5.0",
"matriphe/imageupload": "5.1.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"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"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
and ran the following command.
composer update
It did the trick for me.

Laravel 4 - Class 'Stripe' not found

I'm trying to install Stripe into my project but I'm having issues. I'm getting the error
Class 'Stripe' not found
I used
composer require stripe/stripe-php
and everything installed fine, but I'm still having issues.
This is the line that is causing the problem:
Stripe::setApiKey(Config::get('stripe.secret_key'));
This is my composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.2.*",
"intervention/image": "dev-master",
"moltin/laravel-cart": "dev-master",
"stripe/stripe-php": "~2.0#dev"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/libs",
"app/database/migrations",
"app/database/seeds",
"app/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 artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev",
"prefer-stable": true
}
There is nothing about Stripe in my app/config/app.php file... I'm not sure if there should be a service provider for Stripe.
Looking at packagist, you can see the composer package stripe/stripe-php point to the following GitHub repository. Based on that repository's code and the Stripe API documentation, it doesn't look like there's a global class named Stripe defined. So when you say
Stripe::setApiKey(Config::get('stripe.secret_key'));
and PHP says
Class 'Stripe' not found
PHP is telling you the truth. There is a class named Stripe\Stripe -- so you probably want to do this
\Stripe\Stripe::setApiKey(Config::get('stripe.secret_key'));
or import the class into your current PHP file with the use statement
<?php
//...
use Stripe\Stripe;
//...
Stripe::setApiKey(Config::get('stripe.secret_key'));

Fatal error after creating new Laravel 5 project

I created a brand new Laravel 5 application via laravel new mysite. When I open the site I see the following errors:
Notice: date_default_timezone_set(): Timezone ID '' is invalid in /mysite/storage/framework/compiled.php on line 1790
Fatal error: Call to undefined method Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandler() in /mysite/storage/framework/compiled.php on line 1656
Here is my composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.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"
}
}
I've already ran composer update to make sure I have the latest dependencies, but I'm still getting the same error. Any ideas?
Edit: I'm using PHP 5.4
Edit 2: It works when running via php artisan serve but not when using my my dev box running apache to serve the site. So it could be a local php issue on that box.
I believe this issue has to do with your local server settings. I had the same issue on my local server and I set the value date.timezone in my php.ini

Classes don't seem to load while running tests

I'm new to Laravel and PhpUnit and I'm trying to run some tests located in the \App\Tests\Unit folder on customs classes located in the \App\Musibits directory.
I get the following when I run phpunit in the \App\Tests\Unit directory:
Fatal error: Class 'Tonality' not found in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\musibits\app\tests\TonalityTest.php on line 8
Tonality.php contains my class and is in the \App\Musibits directory
I read numerous posts about autoloading and bootstrap, but I can't seem to make it work :-(
Here is my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.2.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/musibits",
"app/tests"
]
},
"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 artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
There is three autoload files included with Laravel, one for composer, one for phpunit and one for Laravel, I didn't change any.
Any cues would be greatly appreciated.
Thanks,
Phil
You should probably run
composer dump-autoload
to generate new class map

Laravel 4 Using HybridAuth: Not Getting Autoloaded in class map

After downloading hybridauth from composer, I always need to manually add the hybridauth's directory in /vendor/composer/autoload_classmap.php, this should be automatic.
Below is my composer.json, can someone point me the problem why hybridauth is not getting written in autoload automatically?
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"require": {
"laravel/framework": "4.0.*",
"way/generators": "dev-master",
"hybridauth/hybridauth": "*",
"intervention/image": "dev-master"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}
Have you tried
using "hybridauth/hybridauth": "dev-master"
also try
artisan dump-autoload command
Looks like in the latest update they have changed lot of things and your old code won't work with it.
If you are not getting autoload classes in classmap file then better use older version of HybridAuth i.e. 2.9.1
use "hybridauth/hybridauth": "2.9.1" instead of "hybridauth/hybridauth": "dev-master"
Classes will be loaded automatically on autoload classmap file.
This works well on laravel 4 and 5 both.

Resources