I am unable to install nusoap to my existing laravel 5 application. Ive done the following:
Created a new Folder in App/Http/Controllers/ - namend "Soap" - and copied the libary into it.
use
composer dump-autoload
So i am able to use
use nusoap_client;
But i am always getting an error:
Class 'App\Http\Controllers\nusoap_client' not found
I thought that laravel automatically load all classes from the "app" directory, but how can i use it here?
Tried with:
$wsdl = "test.xx/_vti_bin/lists.asmx?wsdl";
$client = new nusoap_client($wsdl, true);
Thanks for any help!
Just add these lines to your controller:
include 'nusoap.php';
use nusoap_client;
As a simple way, you can add a backslash in front of nusoap_client, like this:
$client = new \nusoap_client($wsdl, true);
Related
Good Day, my friends.
I want to use the doctrine ORM with the Migrations.
The issue is next: I want to place the migration configuration file in the specific folder. For example: 'config/doctrine-migrations.php'.
Everything working fine when I follow the official documentation and place the migrations.php file in the root folder, but when I try to place it in the specific folder system is not working.
My cli-config.php content is:
<?php
require_once "app/bootstrap.php";
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($container->get(\Doctrine\ORM\EntityManager::class));
Well, I can change this file in a next way:
<?php
require_once "app/bootstrap.php";
return \Doctrine\Migrations\DependencyFactory::fromEntityManager(
new \Doctrine\Migrations\Configuration\Migration\PhpFile(BP . '/config/doctrine-migrations.php'),
new \Doctrine\Migrations\Configuration\EntityManager\ExistingEntityManager($container->get(\Doctrine\ORM\EntityManager::class))
);
After this, Doctrine Migration working fine, but Doctrine ORM stop working with the next error:
Argument #1 ($helperSet) must be of type Symfony\Component\Console\Helper\HelperSet, Doctrine\Migrations\DependencyFactory given
If someone knows how to solve my issue and use a specific config file please clarify a possible solution.
Best Regards, Mavis.
I may be a bit late, but i ran into the same problem as you.
You can use the same cli-config for migrations and orm. For that, you need add
the orm commands manually to the cli-config.php.
My cli config looks like this:
$em = getEntityManager();
$config = new PhpFile('migrations.php');
$dependencyFactory = DependencyFactory::fromEntityManager($config, new ExistingEntityManager($em));
$migrationCommands = [
new Command\DumpSchemaCommand($dependencyFactory),
new Command\ExecuteCommand($dependencyFactory),
new Command\GenerateCommand($dependencyFactory),
new Command\LatestCommand($dependencyFactory),
new Command\ListCommand($dependencyFactory),
new Command\MigrateCommand($dependencyFactory),
new Command\RollupCommand($dependencyFactory),
new Command\StatusCommand($dependencyFactory),
new Command\SyncMetadataCommand($dependencyFactory),
new Command\VersionCommand($dependencyFactory),
];
$customCommands = [];
$commands = array_merge($migrationCommands, $customCommands);
ConsoleRunner::run(new SingleManagerProvider($em), $commands);
All my import statements, are not included in this example, but you can
get them from the docrtine documentation
Looks like I found an answer.
I can add custom integration in my application by this guide: https://www.doctrine-project.org/projects/doctrine-migrations/en/3.0/reference/custom-integration.html
In a custom file, I can configure whatever I want.
Hope that this solution will help somebody else.
I want to include the Threema library in my Codeigniter project, but I have trouble doing it. This is the library.
I followed the instructions, created an autoload with composer, but I don't know how to make it work. I have an helper that looks like this :
require_once APPPATH . "libraries/Threema/vendor/autoload.php";
//define your connection settings
$settings = new ConnectionSettings(
'*xxxxx',
'xxxxxx'
);
$publicKeyStore = new Threema\MsgApi\PublicKeyStores\File("pathTo/threema_key.php");
$connector = new Connection($settings, $publicKeyStore);
I have the error :
Class 'ConnectionSettings' not found
I tried to do as the guide by using the keyword "use" but that doesn't work either :
use Threema\MsgApi\Connection;
use Threema\MsgApi\ConnectionSettings;
use Threema\MsgApi\Receiver;
What is the simple way to install this library in a CodeIgniter environment ?
try to change this line
require $SERVER['DOCUMENT_ROOT'] ./'libraries/Threema/vendor/autoload.php';
When creating a Client in Evernote sandbox sample:
$client = new \Evernote\Client($token, $sandbox);
I'm getting following error:
Fatal error: Class 'Psr\Log\NullLogger' not found in C:\xampp\htdocs\evernote\evernote-cloud-sdk-php\src\Evernote\Client.php on line 156
I know, this is because of missing: Psr\Log, files but I do not know where I should add them?
I don't want to use composer because I'm not sure if I will be able to use it in production. Anyway the settings is as follows: https://github.com/evernote/evernote-cloud-sdk-php/blob/master/composer.json
Does anyone know how to add the Psr\Log into Evernote PHP SDK API please?
Thank you!
After some testing I found the solution as follows:
download ZIP file of: Psr\Log, from: https://github.com/php-fig/log
save folder: Psr, into folder: evernote-cloud-sdk-php/src
change file: autoload.php, within folder: evernote-cloud-sdk-php/src, as follows:
Add new value into array:
$namespaces = array(
'EDAM',
'Thrift',
'Evernote',
'Psr'
);
Create new function:
function psrAutoload($className, $lastNsPos)
{
return genericAutoload($className, $lastNsPos);
}
Seems to be working so far, hope it will help someone to safe time.
I'm trying to use a method from inside my controller.
This works inside my "view"
use aweber\aweber\aweber_api;
$consumerKey = "XXXX";
$consumerSecret = "XXXXX";
$aweber = new AWeberAPI($consumerKey, $consumerSecret);
but it doesn't work in my controller.
I get the error
Class 'app\controllers\AWeberAPI' not found
Any hints?
I think you extracted AWeber-API-PHP-Library to the path aweber\aweber\aweber_api. The directory structure could be
$ ls aweber\aweber\aweber_api
aweber.php
aweber_api.php
....
If you autoloading classes with composer, AWeberAPI is in root namespace
use \AWeberAPI;
$aweber = new AWeberAPI($consumerKey, $consumerSecret);
If you are not autoloading with composer
require_once('aweber_api/aweber_api.php');
$aweber = new AWeberAPI($consumerKey, $consumerSecret);
Normally the extensione related are in vendor namespace ..
try with
use vendor\aweber\aweber_api;
You have a typo. The name of the php file usually is the same name of the class. So your code should be:
use aweber\aweber\AWeberAPI;
If it isn't, you can try:
use aweber\aweber\aweber_api as AWeberAPI;
Thanks for all the comments here. To fix it I actually moved this functionality into my "view" instead of having it in my controller and it worked.
I wasn't able to test the responses here, so if anyone else if facing the same issues, I'd recommend trying some of these answers.
I have used composer to download the Angell EYE PayPal library into my vendor directory. Now I'm trying to call the class within a controller.
I've tried various methods:
Use \angelleye\PayPal;
at the top of page. I've tried using the require() method.
Within the controller I have used
$paypal = PayPal::PayPal($payment);
And a few other ways, but I just get the error Class not found at line 179 and I'm not sure why.
You just need to load a config file (depending on your framework) and the autoloader.
require_once('includes/config.php');
require_once('vendor/angelleye/paypal-php-library/autoload.php');
Of course, adjust the paths to suit where you have those saved, but the autoloader is what makes the classes available to you.
If you want more direct help you can submit a ticket here.
Thanks for response.
I actually managed to get it working on the framework.
I did nt have to load anything or require the class as the composer autoload must do it for me in the framework.
I simply added :
$PayPal = new \angelleye\PayPal\PayPal($PayPalConfig);
and it started to work.
Im guessing if i want to use the PayFlow i would call using:
$PayPal = new \angelleye\PayPal\PayFlow($PayPalConfig);
I will definately post back if the rest of the proccess fails to work.