How to install "vinelab/http" in laravel 5 - php

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.

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.

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

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

Package development: how to include provider and aliases (Socialite)

I'm developing my first Larvel-based package. I want to include the Socialite package, so I put it like this in my composer.json file
"require": {
"laravel/socialite": "^2.0"
},
Now, how do I include the provider and the alias as you'd normally do in /config/app.php ?
I think by now I've read every stackoverflow there is about this matter, but nothing seems to work.
This is my package's serviceprovider:
public function boot()
{
include __DIR__.'/routes.php';
$this->app->register('Laravel\Socialite\SocialiteServiceProvider');
$this->app->alias('Laravel\Socialite\Facades\Socialite', 'Socialite');
$this->loadViewsFrom(__DIR__.'/../views', 'package-name');
$this->loadTranslationsFrom(__DIR__.'/../lang', 'package-name');
$this->publishes([
__DIR__.'/../views' => resource_path('views/vendor/package-name'),
]);
$this->publishes([
__DIR__.'/../database/migrations/' => database_path('migrations')
], 'migrations');
}
Result:
Class 'Laravel\Socialite\SocialiteServiceProvider' not found
UPDATE
"psr-4": {
"App\\": "app/",
"Rubenwouters\\CrmLauncher\\": "packages/rubenwouters/crm-launcher/src/"
}
In your package's service provider in register method you can do:
public function boot() {
$this->app->register(ClassOfScialiteServiceProvider);
$this->app->alias(FacedeClass, 'Alias');
}
EDIT
But first of all... To add your package in the right way (to the vendor that you can adding a requirments) you have to some how add it to the main composer.json - required list. You can do it with one of below:
1
Adding you package to the official composer repository (packagist)
2
Make your own composer repository like Satis
3
The easiest way is to add your git repo dependanci inside composer.json like:
"repositories": [
{
"type": "vcs",
"url": "git#your_repo/crm-launcher.git"
},
],
"require": {
(...)
"rubenwouters/crm-launcher": "dev-master"
}
OR
or just move your dependencies ("laravel/socialite": "^2.0") to the main composer.json. :)
Register Laravel\Socialite\SocialiteServiceProvider::class, to Config\app.php as providers and also
Register 'Socialize' => Laravel\Socialite\Facades\Socialite::class, to Config\app.php as aliases.
May be this will solve your problem.

Laravel 5.2 - Adding laravelcollective/html 5.2 throws errors

I'm using Laravel v5.2 and have followed the instructions below to install laravelcollective/html, but it still throws errors:
Browser: FatalErrorException in ProviderRepository.php line 119: Call to undefined method Collective\Html\FormFacade::isDeferred()
Artisan: [Symfony\Component\Debug\Exception\FatalErrorException] Call to undefined method Collective\Html\FormFacade::isDeferred()
Also tried 5.2.*-dev, but get the same errors.
Hope someone can help!
Command:
composer require laravelcollective/html
Added to composer.json "require" group:
"laravelcollective/html": "5.2.*"
composer update
Added to config/app.php in providers group:
Collective\Html\HtmlServiceProvider::class,
In aliases group:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
I hope it is not too late, but maybe answer on your question will be useful for a future reference. So, here is step by step:
1) In the root of your laravel package open composer.json file in "require" group should be added this line:
"laravelcollective/html": "5.2.*"
It should look similar to:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.",
"laravelcollective/html": "5.2."
},
2) Open command prompt or Git Bash and update the composer with command:
composer update
The composer will update within about one or two minutes.
3) Open config/app.php add this line in providers group:
Collective\Html\HtmlServiceProvider::class,
and don't forget to separate the previous class by comma. It should look like:
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
4) In the same file in aliases group add these alias:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
so it should look like:
'View' => Illuminate\Support\Facades\View::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
I hope this will help to anyone who use Laravel 5.2.*

Custom Laravel Directory Install With Composer

I was wondering if it was possible to create a custom laravel "template" with composer.
For example, I want to include in my composer's create-project laravel/laravel install these two extensions by default,
https://github.com/briannesbitt/Carbon
https://github.com/maxhoffmann/parsedown-laravel
or additional folders in the root directory so I don't have to re-create them each time.
I don't mean to ask how to install those ^ above,
but I mean to ask how to set it up so that
when i run
composer create-project laravel/laravel projName
It automatically has those files/extensions/etc
created and/or installed
Just add maxhoffmann/parsedown-laravel in your composer.json file:
"require": {
"laravel/framework": "4.1.*", // version could be 4.2.*
"maxhoffmann/parsedown-laravel": "dev-master"
},
The Carbon package is already avaiable with Laravel by default. Also in app/config/app.php add another entry in providers array like this (Check details here):
'providers' => array(
// other entries...
'MaxHoffmann\Parsedown\ParsedownServiceProvider'
),
Also add an entry in aliases array like this:
'aliases' => array(
// other entries...
'Markdown' => 'MaxHoffmann\Parsedown\ParsedownFacade',
),
You said:
or additional folders in the root directory so I don't have to
re-create them each time.
It doesn't make any sense, sorry!.
If I'm understanding you correctly, you can load custom libraries and have them autoloaded via composers "autoload" section. How you actually load the code into you project is up to you. git submodules is a good option. I'm not familiar with the Laravel directory structure so replace the paths to something that fits:
{
"require": {
// requires go here
},
"require-dev": {
// require dev go here
},
"config": {
"bin-dir": "bin/"
},
"autoload": {
"psr-0" : {
"Carbon": "src/lib/Carbon/src",
"Carbon\\Test": "src/lib/Carbon/tests"
}
}
}
Probably best thing to do is install default Laravel, configure as you wish then save your default template on github... that way you can just do git clone url_to_your_template_repository?

Categories