Laravel shopping cart (5.8) - php

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.

Related

symfony 3.4 data fixture

I upgraded symfony 3.3 to 3.4 and now having problem with datafixture bundle , trying to seed data for testing but got this error :
Attempted to call an undefined method named "addClass" of class
"Doctrine\ORM\Internal\CommitOrderCalculator"
this is part of my ccomposer.json file :
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
}
any help will be appreciated
You have to upgrade the data-fixtures manually in your composer.json file. Try to upgrade it to version 1.3 like this:
"doctrine/data-fixtures": "^1.3"

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

Adding a composer package to Laravel 5

"require": {
"infusionsoft/php-sdk": "^1.2",
"laravel/lumen-framework": "5.1.*",
"vlucas/phpdotenv": "~1.0",
"barryvdh/laravel-debugbar": "^2.2",
"goaop/framework": "^2.0",
"php-http/httplug": "^1.1",
"infusionsoft/old-php-isdk": "*"
},
I'm trying to use the "infusionsoft/old-php-isdk" which is in the packagist composer repository but it's not specific to Laravel. I'm using an order controller and it's code that I picked up from another developer so he references the current (and working) "infusionsoft/php-sdk" as the following
"use infusionsoft\infusionsoft;"
What namespace do I call it if it has no namespace from the package?
Here's the original link to the composer package.
https://packagist.org/packages/infusionsoft/old-php-isdk
Am I missing something? Do I need to assign it a namespace? What and where would I put it?

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.

How to use one github repository as a vendor library, with file overrides from my own repository

I am using the Fuel PHP SDK for Marketing Cloud and there are some changes I'd like to make. Since I am also using Heroku, the repository is refreshed on every git push I make.
I need to modify a few files, but since the repo is refreshed on every push, my changes will get overwritten. Is there a way to copy these files into my own repo, declare that as a dependency after the other repo, and override the files in the main repo with my updated files?
For example, the file I want to update is named ET_Get.php. I could update it directly, but then it will be overwritten on every push. I want to duplicate that file out, make some changes, and I want the repo to use that file, not the repo's own file.
My composer.json looks like this
{
"require": {
"salesforce-mc/fuel-sdk-php": "1.3.0",
"guzzlehttp/guzzle": "~6.0",
"ext-soap": "*",
"php": "7.1.28",
"ext-mcrypt": "*",
"twig/twig": "^2.0",
"firebase/php-jwt":">=5.0.0"
},
"autoload": {
"psr-4": {
"FuelSdk\\": "custom-classes",
"Pardot\\": "custom-classes"
}
}
}
So I was thinking I could just create my own repo after the salesforce-mc repo, and have my files override those.
{
"require": {
"salesforce-mc/fuel-sdk-php": "1.3.0",
"salesforce-mc/custom": "1.0",
"guzzlehttp/guzzle": "~6.0",
"ext-soap": "*",
"php": "7.1.28",
"ext-mcrypt": "*",
"twig/twig": "^2.0",
"firebase/php-jwt":">=5.0.0"
},
"autoload": {
"psr-4": {
"FuelSdk\\": "custom-classes",
"Pardot\\": "custom-classes"
}
}
}
Is this possible? It doesn't have to be a separate repo. Any way that I can simply have my own overrides would be fine.
I know I could fork the repo, and use my fork as a dependency, but that seems like overkill...
You can make the call server side using a library such as cURL
Which will work fine if it's an API that responds with some json or xml.
If their page renders something like a html thank you page, you would have to parse that to ensure it worked and then render your own.
If that's the case and you are making a GET call to ExactTargets site, then you could probably just do a header redirect.
If you do have to POST data, then you could also render a new form that is just a "Submit" button, that contains all the data in hidden fields. It would basically be the same as if you submitted to them to begin with.
Hope that helps
This turned out to be exactly what I needed.
https://mnapoli.fr/overriding-dependencies-with-composer/
Use forked repo on github via composer as dependency
All I had to do was fork the original repo, make my changes, then use my repo in the composer.json like below:
{
"require": {
"salesforce-mc/fuel-sdk-php": "1.3.0",
"guzzlehttp/guzzle": "~6.0",
"ext-soap": "*",
"php": "7.1.28",
"ext-mcrypt": "*",
"twig/twig": "^2.0",
"firebase/php-jwt":">=5.0.0"
},
"repositories":[
{
"type":"git",
"url": "https://github.com/user/forked-project.git"
}
],
"autoload": {
"psr-4": {
"FuelSdk\\": "custom-classes",
"Pardot\\": "custom-classes"
}
}
}

Categories