how to import and use Pear XML serializer in Laravel project - laravel

I am trying to use Pear XMLSerializer package ina Laravel project.
I have included the in composer.json and did composer install and composer update.
Now how to i call it and use it in a class - what use statement I should use at top of class to use it in the class?
Thanks

I spent a quite long time in order to get it work, but I couldn't, I found "StreamParser", It gave me the same functionality, https://laravel-news.com/php-7-multi-format-streaming-parser. hopefully, it will help you.

Related

How to override any Model of vendor folder in laravel

I am using MongoDB as database so I need to change model of package tzsk\payu as using original is giving me following error
Call to a member function prepare() on null
I tried excluding original model and overriding using composer it doesn't work.
The only way would be if the package offered the option to use a custom model, like Passport is doing.
As far as I can see, there does not seem to be a way to do that. Thus you'd need to fork the package and edit the Model yourself.

PrestaShop working with Doctrine & Entites

Hello :) On start: I use PrestaShop 1.7.6.2 and MySQL 5.6 and PHP 7.2
I want to create a module on new way with Symfony Controller and Entites without ObjectModel (beacouse like say one of develoeper of PrestaShop: Pablo Borowicz - ObjectModel is deprecated)
So on start I create simple module available at the link
https://github.com/DarkSidePro/testmodule
Controller and routing works perfect the problem is when I try use enity manager
$entityManager = $this->container->get('doctrine.orm.entity_manager');
$testRepository = $entityManager->getRepository(TestmoduleTest::class);
$test = $testRepository->findAll();
And I have error like that:
The class 'DarkSide\Testmodule\Entity\TestmoduleTest' was not found in the chain configured namespaces PrestaShopBundle\Entity
Maybe I doing something wrong? But doc of prestashop of coures is suck about new way of creating a PrestaShop modules
Looking 4 help :)
Thx all :)
The PrestaShop documentation is a completely mess concerning the handling of the Symfony repositories.
Doctrine is looking (by the auto_mapping orm configuration attribute) for the presence of your entity under the Prestashop Entity namespace, so given that your TestmoduleTest entity isn't there, it cannot be found and therefore loaded.
You may have to register your entity under the following namespace : namespace PrestaShop\Module\Testmodule\Entity;
You'll be able to find more about how to create your own repository class inside the official productcomments module here.
Ok the problem is on other way :)
In this case i have problem with my Repository class (probably with constructor of this class)
when I deleted them module start work
Problem solved :)

Laravel mailChimp package error

I try to use the package https://github.com/BlueBayTravel/Mailchimp as in examples but i got an error:
ErrorException in Mailchimp.php line 64:
Undefined property: BlueBayTravel\Mailchimp\Facades\Mailchimp::$users
when i try to use: Mailchimp::users(), while i can get a connection via Mailchimp::getDefaultConnection(); mean the package is completely red, what u guess the problem with me here ?
I saw that you already opened an issue in the package repo.
If you are using Laravel, and you want to use an existing integration with Mailchimp, I would recommend you to give a try to the spatie/laravel-newsletter package. It's the most complete package I've found for the integration Laravel + Mailchimp, and it uses the drewm/mailchimp-api API wrapper (which IMO, is the best php wrapper for Mailchimp). You can find some examples at Freek's blog or at the README file of the project. And if you do not find what you need, you can go to a lower level using the drewm wrapper: $api = Newsletter::getApi();
If this is not what you are looking for, you can always create your own service in Laravel, adapted to your needs and requierements ;)

Loading composer package into Laravel 5.2

I am trying to add the following package to my Laravel 5.2 project. At the top of my class I have added
use PhpImap\Mailbox as ImapMailbox;
use PhpImap\IncomingMail;
use PhpImap\IncomingMailAttachment;
I then do something like this
$mailbox = new ImapMailbox('{imap.gmail.com:993/imap/ssl}INBOX', 'some#gmail.com', '*********', __DIR__);
At the moment, when I visit the page I get
Class 'PhpImap\Mailbox' not found
I have tried many different ways to load it with the same result. Because this package is not Laravel specific, I don't know if I need to add anything else? Normally when I add Laravel packages I create a provider and alias, do I need to do that here?
Any information appreciated.
Thanks

How do I import Twilio in Laravel?

How do I import the Twilio library in Laravel Controller?
I tried several ways of importing in but it does not work
FatalErrorException in TwilioController.php line 13:
Class 'App\Http\Controllers\Services_Twilio' not found
Have you tried to install via composer? The docs seem pretty straight forward.
composer require twilio/sdk
Then you'd initiate the Twilio class in your app. Like so:
$client = new \Services_Twilio($AccountSid, $AuthToken);
Because Laravel is uses namespaces, you'll need to make sure the class reference is pointed to the correct namespace. By adding the \ before Services_Twilio you are referencing the global namespace. You can also use a use statement at the top of your file to reference the Twilio class, so you don't need the \. Here is a good reference on namespaces

Resources