sdk-for-php | Official Appwrite PHP SDK π | Backend As A Service library
kandi X-RAY | sdk-for-php Summary
kandi X-RAY | sdk-for-php Summary
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Make a call to the API
- Get file preview .
- Create a new workflow
- Update the recovery .
- Create a membership .
- List documents .
- Get a Qr Avatar .
- Update user status
- List all queue certificates .
- Get countries .
sdk-for-php Key Features
sdk-for-php Examples and Code Snippets
Community Discussions
Trending Discussions on sdk-for-php
QUESTION
Amazon provides the php example code below to subscribe a number to a topic. However, that only adds one number at a time.
How can I add multiple numbers ($endpoint) to the same topic? What would the code need to be at the end?
PHP Example Code:
...ANSWER
Answered 2022-Mar-20 at 00:49The solution was actually pretty simple. I just needed to add a list of numbers (through an array) and create a foreach loop:
QUESTION
I need to mock the S3Client in my symfony5 project to be able to provoke exceptions and test the reaction of my code to those exceptions. We use aws/aws-sdk-php version 3.*
7 Years ago someone had the same problem and I tried to follow this solution [ PHPUnit - Mock S3Client not working well ] but I get errors.
What I do at the moment:
in my service:
...ANSWER
Answered 2022-Mar-17 at 17:52As often it is easier to find a solution, when you know the name of your problem. I adapted the question title accordingly.
Methods defined in the header of a class, which don't really exist are called "magic methods" and with that knowledge I found a solution to my problem:
A comment under this link set me on the right track: https://carstenwindler.de/php/mocking-magic-methods-with-phpunit/
In the current version of phpunit, which is 9.5, you can use addMethods and this syntax to mock magic methods:
QUESTION
I am using the following PHP script to send an email from my server. I need to send an email to the admin when a new record is created in the DB. So within the same php script that updates the DB, I want to trigger the other script that sends the email.
Problem is no matter what I do, apache will not execute the email script when requested from the web/api.
However, when I run php sendemail.php
from the command line it works. Also when I run php updatedb.php
which includes the exec('php sendemail.php')
also works from the command line (these are all executed with root "ec2-user").
Things I tried:
- I checked the disabled functions in php.ini and it is empty, nothing is disabled.
- I tried changing file permissions to include 'x' for the apache group still no go.
- I tried replacing
exec
withshell_exec
, andinclude
, no luck.
Here is 'sendemail.php':
...ANSWER
Answered 2022-Jan-25 at 05:24Thank you so much @Riz your tip about sudo -u apache php sendemail.php
saved my day! I was able to debug on the command line and it turns out that my mistake was with the line require 'vendor/autoload.php';
in my original sendemail.php
script I was requiring the file from a directory that did not belong to the apache
group. So, once I moved the vendor folder to the same folder as the sendemail.php
script file everything worked great!
Lesson learned: Make sure all required/included files belong to the apache
group. There was no need to grant apache any execution permissions on any file.
QUESTION
I'm trying to understand the best way to track SES event metrics for emails we're sending through SES. Currently, we're sending email campaigns using the API with SentTemplatedEmail(). The configuration set is currently not set up with any event publishing, which I know would be the first step.
My goal is to gather statistics on each batch of emails sent out, like bounce rates, opens etc. Perhaps even identify which email addresses bounced or had errors. Ideally I'd like to gather this information in our own admin system and store this in our internal databases.
I understand I can send the events to Cloudwatch or Kineses Data Firehose. If I were to do either one of these, how would I go about fetching/parsing the information out of these services in order to use it in our in-house apps? Don't understand which of the services above would be appropriate in this regard (if at all) and how to approach it from there.
Any suggestions on how to architecture this, or where to read up on how to do this? I've seen posts on how to go into Cloudwatch and look at metrics from within the console, but can't find much on how to extract this data.
UPDATE: I did find this: https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/cw-examples-getting-metrics.html which would allow me to gather statistics for a time period. Not quite what I wanted, as I'd like to track statistics per a bulk send, but still useful. Also don't see a way to track which emails were rejected, so as maybe to remove them from our list.
...ANSWER
Answered 2021-Nov-15 at 21:57For bounced, success and complaints emails you need to enable the SNS topics for them in SES.
A SQS queue can then be connected to the SNS topic for example bounced emails and then you can get the SQS queue to trigger a Lambda that can process the bounced email information and save it to your DB for further analysis. You can then also use this to remove any email addresses from your address book that bounced and might affect your success rate. Note this is not fine grained.
For fine grained statistics look at this link. You will need to setup configuration sets in SES and use those when you send emails. That will allow you to do fine grained analysis in Cloud Watch.
amazon-ses-now-provides-fine-grained-email-sending-metrics
If you do not want to use Cloud Watch to analyze the metrics then you can export it to Kinesis Firehose or write it to S3 by setting up a Metric Stream in Cloud Watch.
QUESTION
The AWS SDK for PHP getting started guide mentions:
To use the AWS SDK for PHP, you must be using PHP version 5.5.0 or later with the SimpleXML PHP extension enabled. If you need to sign private Amazon CloudWatch URLs, you also need the OpenSSL PHP extension.
- What are private Amazon CloudWatch URLs?
- Is OpenSSL required when using the AWS SDK for PHP?
ANSWER
Answered 2021-Oct-11 at 13:21Unfortunately, that looks like a typographical error in the documentation as private Amazon CloudWatch URLs do not exist.
It probably meant to say sign Amazon CloudFront URLs for private distributions which you can find more about here & in specific to PHP, here.
And no - if you do not need to create signed URLs, there should be no need for the OpenSSL PHP extension when using the AWS SDK for PHP.
QUESTION
Is it possible to retrieve temporary credentials from within a Lightsail instance without storing user credentials within ENV or an AWS credentials file? If possible, I'd like to use those temporary credentials to assume a service role with the necessary permissions to my AWS resources.
I was hoping it'd be possible to grant permission to the instance ARN (similar to EC2) but I haven't been able to figure out how. Any help would be appreciated.
...ANSWER
Answered 2021-Sep-05 at 08:03the frustrating situation is, amazon lightsail is managed outside of your aws account, in short, there's no support for instance profile like in ec2
the only way to access aws resources from your lightsail instance is to use an iam user with correct credentials
QUESTION
I am having an issue with my EC2 instance connecting to our S3 Bucket.
On my ec2 instance, I have php, httpd, aws-cli, aws-sdk installed. I am able to reach the index page where the code is located. Credentials file is set up /usr/share/httpd/.aws/credentials
Code I am using from the Getting Started Basic Usage Guide
...ANSWER
Answered 2021-Jul-14 at 15:47The issue is that the webserver, httpd, was not able to communicate with outside networks. That's why I could use the aws cli and telnet/ ping from the command line, but it was unreachable from the browser.
After running the command setsebool -P httpd_can_network_connect 1
, I was able to connect to my s3 buckets.
QUESTION
Note: I am working through installing an AWS PHP SDK api connection in this question, although my question is entirely about CakePHP structure. Any of the AWS terminology I am using should be pretty simple and is only there to demonstrate the issue with Cake I am running into, if your not familiar with AWS.
I am currently writing some new tables / entities for a CakePHP application I maintain, called Files. They represent images stored on a bucket in Amazon S3. Files contains a value called 'Key' which is more or less the filename of the file represented by the my entity in Cake, matching the filename on S3. The entity looks like this:
...ANSWER
Answered 2021-Apr-18 at 12:35I would not perform an active lookup in a virtual field. I think it's more conventional to only use it for simple things, with data already present.
I think a model (or table-like object) is a more suitable location for code like this.
You might find this question useful for this point: Cakephp 3 - How to integrate external sources in table?
You can make your own finders (neatly tucked inside Behaviors to group your logic) that combine your AWS data with your database data in this order:
- Collect database data, produce an array of lookup keys
- Use the array of keys to perform a single remote lookup
- Combine the remote data with database data.
QUESTION
I have written an integration for the AWS SDK in PHP to send the keys for files on an S3 bucket and retrieve a pre-signed url, which more or less follows this example. This worked perfectly except I need to now check if the file exists on s3 and return empty string if it does not.
I am doing this with my code below:
...ANSWER
Answered 2021-Apr-14 at 18:47You need the s3:GetObject
permission to invoke the HeadObject API, which is what the PHP SDK invokes when your code calls doesObjectExist()
.
If the object you request does not exist, the error Amazon S3 returns depends on whether you also have the s3:ListBucket permission.
- If you have the s3:ListBucket permission on the bucket, Amazon S3 returns an HTTP status code 404 ("no such key") error.
- If you donβt have the s3:ListBucket permission, Amazon S3 returns an HTTP status code 403 ("access denied") error.
So, you probably have s3:ListBucket but not s3:GetObject.
QUESTION
I am deploying my laravel application to AWS Elastic Beanstalk and I'm encountering the problem of persisting the oauth keys for laravel passport.
I went through this and this. While the S3 option sounds reasonable, I still wanted a more secure way and wanted to checkout secret manager from AWS.
Since laravel passport provides the option to load keys from a custom folder, I figured I could use the AWS PHP SDK to retrieve a secret key and write it to storage/app/oauth-public.key
and storage/app/oauth-private.key
and have passport load it from there.
This approach is working fine after deployment to beanstalk but is the storage/app
folder a safe location to generate the oauth.*.key
files? or is there a better way/safer place?
The following is my boot function in Providers/AuthServiceProvider.php
ANSWER
Answered 2021-Jan-20 at 21:45Generally your applications on AWS should be stateless. This means that no data should be stored on the instances as they can be replaced at any time due to scaling in activities, AZ re-balancing or other activities.
Consequently, usually you would store application data outside of your instances. For secretes, such as your keys, good locations could be SSM Parameter Store or Secrets Manager (SM).
You are already using SM which is good in my view. If you store them locally in storage/app
this folder will be deleted anytime you deploy new version of your application. So you have to make sure that you always get the keys from SM. Also you could consider them storing the files in memory, rather then on a hard drive. This would allow you to get them faster without reading them from the local storage.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sdk-for-php
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page