Geolocation package with laravel: Midnite81\Geolocation\GeoLocationServiceProvider' not found - php

I want to use the following package for geolocation with laravel.
https://github.com/midnite81/geolocation
I have done everything they wrote in their documentation but find an error
Midnite81\Geolocation\GeoLocationServiceProvider' not found
i am unable to solve this problem. Can't understand what's wrong. What i did, at first, write "midnite81/geolocation": "1.*" in the composer.json file.
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"midnite81/geolocation": "1.*"
},
After that run composer update. Then run composer dump-autoload -o. Then in the config/app.php file, put the following part in providers and aliases array.
'providers' => [
Midnite81\Geolocation\GeoLocationServiceProvider::class
];
'aliases' => [
'GeoLocation' => Midnite81\GeoLocation\Facades\GeoLocation::class,
];
then run the following command.
php artisan vendor:publish --provider="Midnite81\GeoLocation\GeoLocationServiceProvider"
Then got the error, Midnite81\Geolocation\GeoLocationServiceProvider' not found
Can't figure out what's wrong in it.

I verified and confirm the problem.
The problem is:
Midnite81\Geolocation\GeoLocationServiceProvider::class
You should change this into
Midnite81\GeoLocation\GeoLocationServiceProvider::class
Notice the difference Geolocation vs GeoLocation. It seems there is error in readme for this package on Github
I've already sent Pull request https://github.com/midnite81/geolocation/pull/2 to fix readme for this package

Related

Laravel shopping cart (5.8)

I'm using eclipse PDT, with CodeMix, Terminal+, Composer, and symphony. I created a Laravel project and in my composer.json I have the following dependencies:
"require" : {
"php": "^7.1.3",
"cyvelnet/laravel5-fractal": "^2.3",
"darryldecode/cart": "~4.0",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "dev-master",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"league/fractal": "^0.18.0",
"ssheduardo/redsys-laravel": "~1.3.0"
},
I also added in my app.php both the service provider
'providers' => [
#Lots of other providers here
Darryldecode\Cart\CartServiceProvider::class,
],
and the facade alias
'aliases' => [
#lots of other aliases
'Cart' => Darryldecode\Cart\Facades\CartFacade::class
],
I even published the provider php artisan vendor:publish --provider="Darryldecode\Cart\CartServiceProvider" --tag="config"
But somehow whenever I try to include the thing in any of my files either with use \Cart;, use \Darryldecode\Cart\Facades\CartFacade; or use \Darryldecode\Cart\Cart; it gives me a
The import whichever one I'm using cannot be resolved
Already tried clearing the cache, closing, and opening eclipse, deleting the project from the workspace and starting it again, uninstalling and reinstalling the cart and I don't know what else to do. Also tried Gloudemans instead and it gives me the same error.
Just using
'Cart' => Darryldecode\Cart\Cart::class,
instead of
'Cart' => Darryldecode\Cart\Facades\CartFacade::class
I solved it by manually adding the vendor folder to the builpath, foir some strange reason composer wasn't adding it.

How to solve Exception It is unsafe to run Dusk in production in laravel 5.5?

I upgrated my project from laravel 5.4 to laravel 5.5 ,
I dont have any problem in local env but in server i get this exception ,
I searched a lot and i know this issue may be duplicated but no solutions solved my problem!
How can i not registering dusk when environment is production?
i wrote this code in AppServiceProvider.php :
public function register()
{
// Dusk, if env is appropriate
if ($this->app->environment('local', 'testing')) {
$this->app->register(DuskServiceProvider::class);
}
}
but it seems not working.
can anyone help?
EDITED :
my composer.json file:
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "1.*",
"phpunit/phpunit": "^7.0.3",
"symfony/css-selector": "4.0.*",
"symfony/dom-crawler": "4.0.0",
"barryvdh/laravel-ide-helper": "^2.4",
"laravel/dusk": "^2.0"
},
The Exception is :
Exception
It is unsafe to run Dusk in production.
In Laravel 5.5, packages are automatically discovered and loaded so you will probably need to tell it not to load dusk.
One way is to add this to your composer.json
"extra": {
"laravel": {
"dont-discover": [
"laravel/dusk"
]
}
},
Also, you can add it to your dev dependencies and when you deploy in production, use:
composer install --no-dev
Taylor wrote an article about it here.
Look, it does not work because it is configured to work on local and testing environment.
I guess that you need to add 'production' (if your production is called 'production in your .env file environment:
AppServiceProvider
public function register()
{
// Dusk, if env is appropriate
if ($this->app->environment('local', 'testing', 'production')) {
$this->app->register(DuskServiceProvider::class);
}
}
When installing to production server I just needed to use the --no-dev flag
composer install --no-dev
Good luck!
If you're experiencing this problem while in a developing environment and accidentally landed here due to the title, you should check that your .env file is set up for development. It should contain the line
APP_ENV=local
Here is an example of how the .env file could look: https://github.com/laravel/laravel/blob/master/.env.example
And here is the Laravel documentation: https://laravel.com/docs/5.7/configuration
Also, in composer.json, laravel/dusk should be listed under require-dev and not require.
Check whether file which named .env contained in the source folder and setup Database user name and password and other settings.
I had the same problem because I have set all the things but forgot to change the .env.example to .env

Laravel 5.1 Php artisan commands not working after composer update

here is my composer.json require snippet.
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.35",
"aws/aws-sdk-php-laravel": "~3.0",
"lucadegasperi/oauth2-server-laravel": "5.1.*",
"bosnadev/repositories": " 0.*",
"laravelcollective/html": "5.1.*",
"cartalyst/stripe-laravel": "3.0.*"
},
I ran composer update in order to add new AWS services. but then I noted that all the vendor files are updated because of composer update command. now I'm getting error when I ran php artisan commands.
This is the error message:-
PHP Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator
::__construct() must be an instance of Illuminate\Http\Request, null given, call
ed in C:\Users\User\projects\projectxyz\projectxyzweb\vendor\laravel\framework\
src\Illuminate\Routing\RoutingServiceProvider.php on line 62 and defined in C:\U
sers\User\projects\projectxyz\projectxyzweb\vendor\laravel\framework\src\Illumi
nate\Routing\UrlGenerator.php on line 102
How can I resolve this issue? is there any wayto revert composer update without loosing my code?
I finally manage to get rid of this error. I was not my composer update. I have added url() to set base url in my config files. After removing it php artisan worked.

How to install "vinelab/http" in laravel 5

I am following the documentation at
https://packagist.org/packages/vinelab/http
My composer.json :
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"laravelcollective/html": "~5.0",
"vinelab/http": "dev-master"
},
my app.php in config
'providers' => [
...
/*
* Helpers from packalyst.com
*/
Vinelab\Http\HttpServiceProvider::class
],
'aliases' => [
...
/*
* Helpers from packalyst.com
*/
cURL' => Vinelab\Http\Facades\Client::class
],
Following all the steps diligently.
I run php composer update and get this error.
http://goo.gl/sOj2gG
I am a novice in laravel and composer and am learning my way through.
Thank you for the help guys !
It seems that you have Zjango package in your service provider, but your composer.json file doesn't seem to show it. It is trying to load a service provider that hasn't been loaded via composer.json.
try adding "zjango/laracurl": "dev-master" to your composer.json file and run composer update again.
You have to install the composer package before putting in the service provider.
Remove the provider from the array in config/app.php.
Run composer update.
Put the provider back into the array in config/app.php.

Laravel Traits Error

Fresh install of Laravel, trying to run anything generates a Traits error:
Trait 'Illuminate\Support\Traits\MacroableTrait' not found in /var/www/laravel/bootstrap/compiled.php
I have tried manually adding in \Traits\MacroableTrait.php and this now generates a new error:
Trait 'Illuminate\Http\ResponseTrait' not found in /home/vagrant/innovedV2API/bootstrap/compiled.php
Any ideas what's happening here?
Try to edit your composer.json in a way to put all "require" elements together, like this:
"require": {
"laravel/framework": "4.2.*",
"dompdf/dompdf" : "dev-master",
"stripe/stripe-php" : "dev-master",
"fzaninotto/faker" : "dev-master"
}
I think my error was that I have written another require block with faker, dom and stripe at the end of the file, and tried to run composer update like that.
Another error may be migrating databases before composer update, or artisan db:seed

Categories