Laravel 5.2 Class 'Collective\IronQueue\IronQueueServiceProvider' not found - php

I am trying to use the IronMQ driver in the latest version of Laravel (5.2) and am getting the below error;
Class 'Collective\IronQueue\IronQueueServiceProvider' not found
Here is my configuration.
composer.json:
"iron-io/iron_mq": "~2.0"
config/app.php:
'providers' => [
Collective\IronQueue\IronQueueServiceProvider::class,
],

Try to use version 3 :
"iron-io/iron_mq": "~3.0"
And don't forget to update your composer :
composer update
Hope this helps.

I managed to fix the issue by adding:
"laravelcollective/iron-queue": "5.2.*"
to composer and then running update:
composer update
It doesn't mention this step on the Laravel Collective website.

Related

Laravel Upgrade From 5.6 to Laravel 6

I have a Project https://github.com/javedbaloch4/Laravel-Booking developed in Laravel 5.6 now I want to upgrade it to Laravel 6. What are the steps can I directly update to 6 or first goto 5.7, 5.8 and then.
Please can guide the steps here for a quickly upgrade Thanks.
Step 1 : Remove the followings from your composer.json file
"laravelcollective/html": "^5.4.0",
"yajra/laravel-datatables-oracle": "^8.4"
Step 2 : Replace this line
"laravel/framework": "5.6.*",
To this
"laravel/framework": "^6.0",
Step 3 : Run Following commands in order
composer require laravel/helpers
composer require laravelcollective/html
composer require yajra/laravel-datatables-oracle
composer require yajra/laravel-datatables-buttons
composer require yajra/laravel-datatables-html
composer require yajra/laravel-datatables-fractal
composer require yajra/laravel-datatables-editor
composer update
composer dumpa
Key Point to notice and understand is whenever you want to upgrade
make sure all the packages you're using have compatibility with correct versions of laravel and php. Check and follow the repo. on git to get notified if any new upgrades are there.
That's It, You're Good to go.
The official framework documentation tells you exactly how to upgrade:
https://laravel.com/docs/5.7/upgrade
https://laravel.com/docs/5.8/upgrade
https://laravel.com/docs/6.x/upgrade
https://laravel.com/docs/7.x/upgrade
You can also use https://laravelshift.com if you need any automatized solution.

Laravel use package in package

I'm developing a package in Laravel 5.5 where I need this package:
https://github.com/laracasts/PHP-Vars-To-Js-Transformer
The problem is that It's not registering for some reason. When I dd in the JavaScriptServiceProvider.php nothing happens. When I use the Javascript facade I get an error that it does not exists?!
My package composer.json file:
"require": {
"php" : "^7.0",
"illuminate/support": "~5.5.0",
"laracasts/utilities": "^3.0"
},
I use Laravel 5.5 so it should be registered by default (composer.json from laracasts package):
"extra": {
"laravel": {
"providers": [
"Laracasts\\Utilities\\JavaScript\\JavaScriptServiceProvider"
],
"aliases": {
"JavaScript": "Laracasts\\Utilities\\JavaScript\\JavaScriptFacade"
}
}
}
What am I doing wrong here?
I faced the same problem using different other packages in my own package.
Here are the steps that worked for me:
Add the required package as a dependency in your own package:
composer require laracasts/utilities
Update your package in the Laravel project (e.g. by incrementing the version number or by removing your package and reinstalling it.
composer update # in main Laravel project
Then you should see, that in the main Laravel project there is auto-discovery of your own package and the dependency to laracasts/utilities.
Let me know if this helped you or if I can give more assistance.
You need to following steps, to solve this issue :
Run the command in your packages directory :
composer require laracasts/utilities
Now use this in your package (on top of the file) whenever you want to use this dependency:
use Laracasts\Utilities\JavaScript\yourClassName

Laravel5 Class 'Laravel\Socialite\SocialiteServiceProvider' not found

I've added
"laravel/socialite": "~2.0"
as a composer dependency, and i've added the service provider in my config/app.php just like this
'providers' => [
// more providers
'Laravel\Socialite\SocialiteServiceProvider'
]
Then, when i access to any of my application route, i've got this Class 'Laravel\Socialite\SocialiteServiceProvider' not found exception.
Looking into my vendor/composer/autoload_psr4.php i see there's not the Socialite mapping - ive ran composer update and composer dump-autoload more than once.
What's wrong?
Did you run the composer command before adding the provider to the file? If not, this can sometimes cause issues.
I recommend removing the reference from the config file and the composer.json, then running composer request laravel/socialite 2.0. Also, just fyi, using the ::class notation in the providers listing will help if you're using a full IDE like phpstorm, as it will highlight when it can't find the class.
I have removed the reference from the config file and the composer.json, then ran composer require laravel/socialite 2.0 instead of composer request laravel/socialite 2.0.
Then add the following lines to the config file
Laravel\Socialite\SocialiteServiceProvider::class,
and
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
first of all remove the line
Laravel\Socialite\SocialiteServiceProvider::class,
and also
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
from Config\app.php and update the composer by adding
"laravel/socialite": "^2.0" and after that add these two line in Config\app.php it will work because when you add these lines before updating composer it goes to vender folder and search for the SocialiteProvider but it is not available yet so when you will update composer first and then add these lines it will work fine
At first of all, check if your socialite package is compatible with your Laravel version.
You can verify your Laravel version inside your Laravel path, for it type:
$ php artisan --version
Then, check in the socialite Git repository (link below) a compatible version with your Laravel.
https://github.com/laravel/socialite/releases
Now install the socialite package with composer require laravel/socialite x.x (where x.x is your socialite choosed version)
Lastly add the following lines in config/app.php file
inside 'providers' => [
Laravel\Socialite\SocialiteServiceProvider::class,
and almost at the end of the file, inside 'aliases' => [
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
Save the file.
first of all you need to clear the cache of your project by this code
php artisan config:cache
and then you need to enter this code in the terminal (for facebook for example)
composer require socialiteproviders/facebook
in the previous line i ended it with facebook as an example but you could change it like instagram or anything else and the error will be solved

How to include ServiceProviders in Laravel 5 manually?

I just want to ask a question. I just want to ask if there's a way to include ServiceProviders in Laravel manually? I looked in github page and I saw some laravel serviceprovider. How can I include those in my laravel file? I am new to laravel and I am studying this in our home without an Internet connection. I downloaded the HTMLServiceProvideer manually and I also tried the command:
composer require illuminate/html
Can the composer run without having an Internet Connection? If no how can I install a serviceprovider by using the master-files? Where should I place the files and what file should I need to update?
I believe this is possible but you need to manually do the work of the Composer.
So for instance lets assume want to manually install illuminate/html package.
You can follow these steps:
Add "illuminate/html": "5.*" to your composer.json although we are not using Composer for installing this package, its important we have this listed in composer.json should in case we run 'composer update' in the future our manually added package will not be deleted but rather updated.
"require":{
"laravel/framework": "5.0.*",
"illuminate/html": "5.*"
}
Manually download the package from Github and place the package inside
vendor directory which is located at the root of your laravel application
example in mylaravelapp/vendor
Add the package to mylaravelapp/vendor/composer/autoload_namespaces.php
return array(
.....
'Illuminate\\Html\\' => array($vendorDir . '/illuminate/html'),
);
Add the package to mylaravelapp/vendor/composer/autoload_namespaces.php
return array(
....
'Illuminate\\Html\\' => array($vendorDir . '/illuminate/html'),
);
Run composer dump-autoload to check for errors
Add Package service provider in config/app.php 'providers' => []
Run composer dump-autoload once more
Service Providers are added to your config/app.php
But you will need to have that package downloaded...

Laravel 5 error while installing package

When i was upgrading from laravel 4.2 to laravel 5 i got this error while installing packages from composer
Call to undefined method Illuminate\Config\Repository::package()
This problem is because the package you're trying to use has not yet been updated to work with Laravel 5.
There is no work around or fix, you must wait for the package to be updated, or fork it and submit a PR
add this to your composer.json
"require": {
"laravel/framework": "dev-master#846c935194a036901ba6b4397c8897fa51e19111",
...
}
for more information see link below:
https://laracasts.com/discuss/channels/general-discussion/l5-latest-commit-breaks-if-using-waygenerators-or-image-internvention

Categories