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 ;)
Related
I want to use avatar in my faker users seeding and I try to use https://github.com/ottaviano/faker-gravatar
But I got error trying to install it :
[InvalidArgumentException]
Package ottaviano/faker-gravatar has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version:
- ottaviano/faker-gravatar 0.1.2 requires php ^7.1 which does not match your installed version 8.1.0.
Looks like it does not support php 8...
Are there similar pluging supporting php 8 ?
Or maybe I can tune this plugin to work under php 8?
Thanks in advance!
You could create an issue on the repo and request that the maintainer update the package to support PHP 8. Alternatively you could fork the repo and either maintain that fork yourself, or create a pull request once you've updated the package.
With the above in mind though, something to note is that package is using an abandoned faker library. There is a new fork that is recommended for use but does not have a gravatar provider.
You could write your own provider for the newer faker library or alternatively go down the very simple route of just implementing a statement to generate a gravatar yourself.
'https://www.gravatar.com/avatar/' . md5(strtolower(trim($faker->email()))) . '?d=identicon';
The above will look for an existing gravatar for the provided email address and return that if it finds one, otherwise will return a default gravatar image which in my example is a geometric pattern based on the email hash.
Whilst this solution might not be as flexible as the package in your question, if all you're after is a gravatar and don't care whether it's isometric or a robot (see default images in the API docs for changing the default image generated) then something simple like this might be all you need.
I Need to get the Sha512 or similar from a Golang package for SBOM purposes.
For example, the hash for package
https://pkg.go.dev/encoding/json
I can't found any information or api to get it. If possible I need it without download the source code.
I think you are looking for sum.golang.org which is
an auditable checksum database which will be used by the go command to
authenticate modules.
you can read more on how it works on this post from go blog
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.
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
I am implementing Twilio in Laravel 5, the tutorial I am using is very good https://www.twilio.com/blog/2014/09/getting-started-with-twilio-and-the-laravel-framework-for-php.html.
Do you know what the namespace is for laravel 5?
I am getting
Class 'Services_Twilio_Twiml' not found
Thanks
If you install the twilio/sdk package via composer you should have access to all the Twilio classes automatically, since laravel uses composer's autoloading.
They are not really namespaced. You would use \Services_Twilio_Twiml.
You can tell composer to load your Twilio folder by adding :
"autoload" : {
"classmap" : [ "your/Twilio/folder" ]
}
to your composer.json
If I understood you clearly you have put your Twilio code in a given file and you are getting this error saying "Class 'Services_Twilio_Twiml' not found".
I am writing here possible reason you are getting this.
/config/services.php- you have not added Twilio details which are
i. sid
ii. token
iii. from
in file in which you have integrated your Twilio code, you have to ensure to write use Twilio;
In your app.php you have to add in providers section Twilio which you are using for example: 'Aloha\Twilio\TwilioServiceProvider'
and aliases section 'Twilio' => 'Aloha\Twilio\Facades\Twilio',.
If you look at this you might find answer.
For Laravel 5 (and older Laravel 4 applications) I suggest using the aloha/twilio package. It provides some code samples in the readme file that should help you get going quickly. One can inject a configured object using the TwilioInterface type hint which has methods to send SMSs MMs and calls.