I uploaded the paypal php sdk to my codeigniter app inside the libraries/paypal folder.
In the same folder I create a paypal.php file and inside it I insert this code:
<?php
require __DIR__ . '/common.php';
use PayPal\Api\Amount;
use PayPal\Api\Details;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\RedirectUrls;
use PayPal\Api\Transaction;
class Paypal{
function createPayment(){
$payer = new Payer();
$payer->setPaymentMethod("paypal");
//....
}
}
but when I call this function in my controller I get this error:
Fatal error: Class 'PayPal\Api\Payer' not found in '....'
I don't understand why instead common.php is imported correctly.
In my app I also have the Facebook sdk and I created the same structure to use it and it works
Best way is to follow these steps.
Download the SDK using composer.
Upload the vendor directory into codeIgniter Application root.
Then in the index.php file put this line
include "./vendor/autoload.php";
Now you can access the Paypal SDK and its dependent libraries easily.
Related
i'm new to laravel. And I have the website up now with forge. The only issue is that I cannot see or store the photos. Do I have to write the storagelink command somewhere, and if then, where exactly? I changed the file system driver to public on the env file as well
you can do that by creating the symbolic link using the facade Artisan
basically you will need to create a new route at web.php as bellow :
Route::get('/linkstorage', function () {
Artisan::call('storage:link');
});
and , of course , don't forget to import the class at the very top of the file like so :
use Illuminate\Support\Facades\Artisan;
make sure you update the hosted file as changed .
and simply , to create your symlink , you will need to navigate to /linkstorage and that's it !
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once(dirname(__FILE__) . '/dompdf/autoload.inc.php');
class Pdf{
I cant generate a pdf from, keeps says dompdf class not found, tried extending CI_Controller, even extending dompdf class still cant resolve.
If you are using composer then it would be an easy task to add DOM Pdf compatibility in your project. This is the Repository of DOM Pdf.
You can Install it By using Composer Package Manager
composer require dompdf/dompdf
And You have to enable Autoload in your Codeigniter Project.
To autoload resources, open the application/config/autoload.php file
and add the item you want to load to the autoload array. You’ll find
instructions in that file corresponding to each type of item.
Additionally, if you want CodeIgniter to use a Composer auto-loader,
just set $config['composer_autoload'] to TRUE or a custom path in
application/config/config.php.
And Finally, Set the Path of vendor/autoload.php in application/config/config.php
$config['composer_autoload'] = FCPATH . 'vendor/autoload.php';
Please Check the CI3 Documentation Here https://codeigniter.com/userguide3/general/autoloader.html
While using the above package in laravel I'm getting error as
"Class 'Kazist\ResellerClub\APIs\Controller' not found"
Please suggest me a solution how to call the reseller club api "url" in the controller.
$request = file_get_contents('https://httpapi.com/api/domains/available.json?auth-userid=USER_ID&api-key=API_KEY&domain-name='.$slds.'&tlds='.$tlds.'');
Please help me with a solution how to declare the domain-name and tlds from the above url in laravel.
For package installation:
From terminal go to your project's root directory and run this command:
composer require kazist/resellerclub-php-sdk
And then after successful installation one new folder called kazist will be created inside project's vendor directory.
For using api calls you need to use Guzzle http client https://github.com/guzzle/guzzle or use this link.o
Edit
Yourcontroller.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use
class Yourcontroller extends Controller
{
$resellerClub = \Kazist\ResellerClub\ResellerClub(<userId>, <apiKey>, true); // Last argument is for testmode.
// Get Available TLDs
$resellerClub->domains()->getTLDs();
// Check Domain Availablity
$resellerClub->domains()->available(['google', 'example'], ['com', 'net']); // This will check google.com, google.net, example.com and example.net
}
I have an existing website up and running, and now I want to add a REST interface to it in an api subdirectory. I'm not able to get this to work with versioning. I installed like so (no errors):
$ php ~/bin/composer.phar create-project laravel/database --prefer-dist api
$ cd api
$ php ~/bin/composer.phar require restler/framework 3.0.0-RC6
Then I uncommented the lines in public/index.php related to Restler and add a new API class that just echos a string. If I run this via php artisan serve and look at it through the localhost URL, then the method works.
Now I want to enable versioning, so I added these lines to public/index.php
use Luracast\Restler\Defaults;
Defaults::$useUrlBasedVersioning = true;
And in app/controllers I created a v1 directory and moved Test.php into that. I also added a namespace directive to the file of the format namespace A\B\v1
When I restart the artisan server and query the API, I get a 404 error. I've tried as both http://localhost:8000/Test and http://localhost:8000/v1/Test
What have I forgotten to do?
Here is how I made it to work. Note the folder where I placed the api class file.
in index.php
use Luracast\Restler\Restler;
use Luracast\Restler\Defaults;
Defaults::$useUrlBasedVersioning = true;
$r = new Restler();
$r->addAPIClass('A\B\Test');
Test.php kept in app/controllers/A/B/v1/Test.php
<?php namespace A\B\v1;
class Test
{
public function get()
{
return 'working';
}
}
Both http://localhost:8000/v1/test and http://localhost:8000/test return "working"
I’m getting error when trying to autoload ion_auth library
application/config/autoload.php
$autoload['libraries'] = array('database', 'template', 'asset', 'ion_auth/ion_auth');
folder structure:
application/
...
modules/
ion_auth/
...
config/
ion_auth.php
...
tester/
controllers/
tester.php
I try to var_dump($this->ion_auth) on tester.php and get error message:
The configuration file ion_auth.php does not exist.
I try to $this->load->library('ion_auth/ion_auth') from tester.php and remove the ionauth from autoload, It still error. How to solve this?
I download codeigniter from link on codeigniter.com and download Modular Extension from bitbucket
It's not an issue with Modular Extensions. You need to put the config file for Ion Auth into the main application's config folder, not in the Ion Auth directory.
Just move it from application/modules/ion_auth/config/ion_auth.php to application/config/ion_auth.php. That will take care of the config error, but you'll probably need to move the entire Ion Auth library into application/libraries.
I don't use Modular Extensions, but from the looks of your code, I'd venture to guess that CI doesn't know to look in the ion_auth folder for the config folder.
If Modular Extensions has a config option, make sure to set it to look in the extension's folder for a config folder. If it doesn't, you'll need to either tell CI directly about the config folder, or put the ion_auth config file into a recognized config folder.
I'm doing exactly the same as you, HMVC from wiredesignz, CI and Ion_auth and I had the same problem. I solved it loading the config file PRIOR the library, :P, I don't know if this would be your problem, but I also had exactly the same error message. My construct method with Ion_auth looks like
class Auth extends MY_Controller {
function __construct()
{
parent::__construct();
// THIS LINE BEFORE LOAD THE LIBRARY:
$this->load->config('auth/ion_auth', TRUE);
$this->load->library('ion_auth');
$this->load->library('session');
$this->load->library('form_validation');
$this->form_validation->CI = & $this;
$this->load->database();
$this->load->helper('url');
$this->load->helper('cookie');
$this->load->library('email');
$this->load->library('session');
$this->lang->load('auth/ion_auth');
$this->load->model('auth/ion_auth_model');
}