QuickBook Autoload Integration with codeigniter (Fatal error: Class 'DataService' not found) - codeigniter

I am facing prob to integrate Quickbook with codeigniter.
I installed the Quick book with following commands
$ composer require quickbooks/v3-php-sdk
$ composer update
but when I call that from controller it returns an error
$configpath = '../vendor/quickbooks/v3-php-sdk/src/sdk.config';
$dataService = DataService::Configure($configpath);

On the start of your php script, add
use QuickBooksOnline\API\DataService\DataService;

Related

Installing and using Mink with Browserkit driver

I seem to be unable to install Mink with Browserkit driver on Centos.
I am using these instructions: https://github.com/minkphp/MinkBrowserKitDriver
The steps I am taking is by:
adding a file in my project directory with the name composer.json and the contents:
{
"require": {
"behat/mink": "~1.5",
"behat/mink-browserkit-driver": "~1.1"
}
}
Use the commands as below.
$> curl -sS https://getcomposer.org/installer | php
$> php composer.phar install
Now there are 3 files (composer.json, composer.lock, composer.phar) and one folder (vendor) in the project directory. Where do I run the "Usage example" code from (as on the documentation)?
I have tried adding require_once "vendor/autoload.php"; to my test.php file:
<?php
require_once "vendor/autoload.php";
use Behat\Mink\Mink,
Behat\Mink\Session,
Behat\Mink\Driver\BrowserKitDriver;
use Symfony\Component\HttpKernel\Client;
$app = require_once(__DIR__.'/app.php'); // Silex app
$mink = new Mink(array(
'silex' => new Session(new BrowserKitDriver(new Client($app))),
));
$mink->getSession('silex')->getPage()->findLink('Chat')->click();
but getting a fatal error that app.php cannot be opened. I have also tried adding the following to test.php:
require_once 'vendor/behat/mink-browserkit-driver/tests/app.php';
Any help would be appreciated :)
Its seems you're missing some guideline in order to organize your code. Before integrating Behat and Mink, first of all you should organize your Silex project. My advice is for you to take a look at the official Silex Skeleton project.
After that you can start by installing behat, mink and your driver:
cd path/to/your/silex/project/root
composer require behat/behat:~2.5 behat/mink behat/mink-browserkit-driver
Then you can initialize behat.
bin/behat --init
Then configure your mink driver in behat.yml (on your project root directory)
default:
extensions:
Behat\MinkExtension\Extension:
browserkit: ~
base_url: http://my.dev.host
Notice that browser kit cannot execute JS, remember that (if you want to execute JS on your tests, you should install another driver)
After that you can start writing your features on the features directory (behat should've created that for you), for example if you have this controller in src/controllers.php:
<?php
//...
$app->get('/hello', function () use ($app) {
return new Response("Hello world!");
});
You can write the feature (on features/greeting.feature):
Feature: Greetings from /hello page
In order to say hello world
As a visitor
I need to go to the /hello page and see Hello world!
Scenario: See Hello world!
Given I am on "/hello"
Then I should see "Hello world!"
Another option is to use full behat extension for silex: https://github.com/tabbi89/Behat-Silex-Extension
You can check how integrations of Mink and browserKit work there.

laravel PackageServiceProvider not found; moving from workbench to vendor

This is basically a problem of moving a laravel package from workbench to vendor, but the solutions in other threads have not worked in this case:
I have a package iateadonut/signup.
I created a fresh laravel installation (laravel_test), and, just for testing sake, I put iateadonut/signup in laravel_test/workbench/.
I put Iateadonut\Signup\SignupServiceProvider, in the 'providers' array in app.php.
I then run:
/laravel_test> php artisan dump-autoload
and get:
Generating optimized class loader
Running for workbench [iateadonut/signup]...
My package is successfully installed.
On a fresh installation of laravel (laravel_test), I then put iateadonut/signup in larael_test/vendor.
I put Iateadonut\Signup\SignupServiceProvider, in the 'providers' array in app.php.
I then run:
/laravel_test> php artisan dump-autoload
and get:
PHP Fatal error: Class 'Iateadonut\Signup\SignupServiceProvider' not found in /var/www/html/laravel_test/bootstrap/compiled.php on line 4214
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Iateadonut\Signup\SignupServiceProvider' not found","file":"/var/www/html/laravel_test/bootstrap/compiled.php","line":4214}}
Any idea what could be wrong?
Here is a more google friendly version in case someone else is looking for this:
PHP Fatal error: Class 'Vendor\Package\PackageServiceProvider' not found in /var/www/html/laravel/bootstrap/compiled.php on line 4214
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Vender\Package\PackageServiceProvider' not found","file":"/var/www/html/laravel/bootstrap/compiled.php","line":4214}}
Try to remove the the bootstrap/compiled.php file and try your composer dumpautoload again

Magento Command line script Class 'SoapClient' not found

I am trying to run a script from commandline to call a method in a Model, which involves the class SoapClient But come up with the error message
PHP Fatal error: Class 'SoapClient' not found in ....
Line which has the error is
$client = new SoapClient($this->_soapUrl);
I run the same process through web using a test route and it works.
Checked PHPINFO and it says
Soap Client enabled
Soap Server enabled
How can I include the SoapClient Class to the script or what can be the solution?
Your command line PHP uses different php.ini. Find out which php.ini file is used in PHP CLI and make sure the Soap extension is loaded there as well.

how to get the console working with Doctrine and CodeIgniter

I've been following this great tutorial :
http://www.joelverhagen.com/blog/2011/05/setting-up-codeigniter-2-with-doctrine-2-the-right-way/
and at some point, you're supposed to create a doctrine-cli.php file in my app' application folder with the following code to execute Doctrine's commands from the command line:
My Doctrine repository is in /back-meetmyfriend/application/libraries/Doctrine and the Doctrine.php in libraries.
However, I can't get the console working on W7/WAMP:
I've followed step by step the tuts and my repo is
E:\Programmes\wamp\www\back-meetmyfriend\application
and in the git Bash console when in /e/Programmes/wamp/www/back-meetmyfriend/application i type down $ php doctrine-cli.php
I'm having a PHP Fatal error: Class 'Symfony\Component\Console\Helper\HelpserSet not found
Is there something wrong with my APPPATH ? how should I configure it ?
Thanks

CodeIgniter + omnipay installation

I have used ci-merchant before but from everything see that the "V2" of it is now omnipay. I use codeigniter and i'm struggling to get even the example to work.
I have installed omnipay no problems and in my controller have the following:
use Omnipay\Common\GatewayFactory;
class Homepage extends BC_basecontroller {
public function index()
{
$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername('adrian');
$gateway->setPassword('12345');
}
}
Which is the example here: https://github.com/adrianmacneil/omnipay
However I get the error:
PHP Fatal error: Class 'Omnipay\Common\GatewayFactory' not found in......
Does anyone know how to get it to work in CI?
I'm not sure how you installed Omnipay, but you need to use Composer to load the classes before you can use them.
So following the Omnipay installation instructions, add this to a composer.json file in your root directory:
{
"require": {
"omnipay/omnipay": "*"
}
}
Then install the files:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
Now, if you are using CodeIgniter you will need to set it up to include the composer autoloader. Basically, just add this line to the top of your index.php file:
require_once __DIR__.'/vendor/autoload.php';
There is also a tutorial on using Composer with CodeIgniter here which you may find helpful: http://philsturgeon.co.uk/blog/2012/05/composer-with-codeigniter
I had the same error and fixed it by loading vendor/autoload.php before application/core/CodeIgniter.php

Resources