{"id":18,"date":"2017-08-01T11:39:45","date_gmt":"2017-08-01T08:39:45","guid":{"rendered":"http:\/\/langelov.com\/?p=18"},"modified":"2017-08-01T23:18:31","modified_gmt":"2017-08-01T20:18:31","slug":"how-to-use-amazon-php-aws-sdk","status":"publish","type":"post","link":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/","title":{"rendered":"How to use Amazon PHP AWS SDK"},"content":{"rendered":"<p>If you have to use one of their services with the new PHP SDK 3.31 you will have to first install it using composer<\/p>\n<pre><code class=\"language-php\">composer install aws\/aws-sdk-php<\/code><\/pre>\n<p>then you have to<\/p>\n<ul>\n<li>Create AWS account here <a href=\"https:\/\/aws.amazon.com\" target=\"_blank\">https:\/\/aws.amazon.com<\/a><\/li>\n<li>Go to <a href=\"https:\/\/docs.aws.amazon.com\/IAM\/latest\/UserGuide\/id_credentials_access-keys.html?icmpid=docs_iam_console\" target=\"_blank\" rel=\"noopener\">How to get Access keys<\/a> for Access keys instructions<\/li>\n<li>Add user with Full access to your desired service<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p>And the sample PHP code is:<\/p>\n<pre><code class=\"language-php\">use Aws\\Sdk;\n$sdk = new Sdk([\n    &#039;region&#039; =&gt; &#039;eu-west-1&#039;, \/\/ your account region\n    &#039;version&#039; =&gt; &#039;latest&#039;,\n]);\n\/\/ This is example using AWS SQS\n$sqs = $sdk-&gt;createSqs([\n    &#039;region&#039; =&gt;&#039;eu-west-1&#039;, \/\/ your account region\n    &#039;version&#039; =&gt; &#039;latest&#039;,\n    &#039;credentials&#039; =&gt; [\n        &#039;key&#039; =&gt; &#039;access_key&#039;,\n        &#039;secret&#039; =&gt; &#039;secret_access_key&#039;,\n    ],\n]);\n<\/code><\/pre>\n<p>You can also put the access key and secret access key in the environment vars and the SDK will get them from there or you can check this URL for <a href=\"http:\/\/docs.aws.amazon.com\/aws-sdk-php\/v3\/guide\/guide\/credentials.html\" target=\"_blank\" rel=\"noopener\">how to use credentials<\/a><\/p>\n<pre><code class=\"language-php\">putenv(&#039;AWS_ACCESS_KEY_ID=&#039; . $accessKey);\nputenv(&#039;AWS_SECRET_ACCESS_KEY=&#039; . $secretAccessKey);\nputenv(&#039;AWS_SESSION_TOKEN=&#039; . $sessionToken);\n<\/code><\/pre>\n<p>In the PHP SDK they are using <a href=\"http:\/\/docs.aws.amazon.com\/aws-sdk-php\/v3\/guide\/guide\/promises.html\" target=\"_blank\" rel=\"noopener\">Promises<\/a> and because of that you will need <a href=\"http:\/\/docs.aws.amazon.com\/aws-sdk-php\/v3\/api\/class-Aws.Sqs.SqsClient.html\" target=\"_blank\" rel=\"noopener\">these Class reference docs<\/a> to check all properties and methods of all services<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have to use one of their services with the new PHP SDK 3.31 you will have to first install it using composer composer install aws\/aws-sdk-php then you have to Create AWS account here https:\/\/aws.amazon.com Go to How to get Access keys for Access keys instructions Add user with Full access to your desired &hellip; <a href=\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to use Amazon PHP AWS SDK&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2,3,4,5],"class_list":["post-18","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-amazon","tag-php-aws-sdk","tag-siege","tag-xdebug"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to use Amazon PHP AWS SDK - Lyubomir Angelov<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use Amazon PHP AWS SDK - Lyubomir Angelov\" \/>\n<meta property=\"og:description\" content=\"If you have to use one of their services with the new PHP SDK 3.31 you will have to first install it using composer composer install aws\/aws-sdk-php then you have to Create AWS account here https:\/\/aws.amazon.com Go to How to get Access keys for Access keys instructions Add user with Full access to your desired &hellip; Continue reading &quot;How to use Amazon PHP AWS SDK&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/\" \/>\n<meta property=\"og:site_name\" content=\"Lyubomir Angelov\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-01T08:39:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-08-01T20:18:31+00:00\" \/>\n<meta name=\"author\" content=\"Lyubomir\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@angelovcode\" \/>\n<meta name=\"twitter:site\" content=\"@angelovcode\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lyubomir\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/\"},\"author\":{\"name\":\"Lyubomir\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\"},\"headline\":\"How to use Amazon PHP AWS SDK\",\"datePublished\":\"2017-08-01T08:39:45+00:00\",\"dateModified\":\"2017-08-01T20:18:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/\"},\"wordCount\":130,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\"},\"keywords\":[\"amazon\",\"php-aws-sdk\",\"siege\",\"xdebug\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/\",\"url\":\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/\",\"name\":\"How to use Amazon PHP AWS SDK - Lyubomir Angelov\",\"isPartOf\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#website\"},\"datePublished\":\"2017-08-01T08:39:45+00:00\",\"dateModified\":\"2017-08-01T20:18:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/lyubomir-angelov.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use Amazon PHP AWS SDK\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#website\",\"url\":\"https:\/\/lyubomir-angelov.com\/blog\/\",\"name\":\"Lyubomir Angelov\",\"description\":\"The life of a Manager\",\"publisher\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/lyubomir-angelov.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\",\"name\":\"Lyubomir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g\",\"caption\":\"Lyubomir\"},\"logo\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/angelovcode\"],\"url\":\"https:\/\/lyubomir-angelov.com\/blog\/author\/superfly\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use Amazon PHP AWS SDK - Lyubomir Angelov","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/","og_locale":"en_US","og_type":"article","og_title":"How to use Amazon PHP AWS SDK - Lyubomir Angelov","og_description":"If you have to use one of their services with the new PHP SDK 3.31 you will have to first install it using composer composer install aws\/aws-sdk-php then you have to Create AWS account here https:\/\/aws.amazon.com Go to How to get Access keys for Access keys instructions Add user with Full access to your desired &hellip; Continue reading \"How to use Amazon PHP AWS SDK\"","og_url":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/","og_site_name":"Lyubomir Angelov","article_published_time":"2017-08-01T08:39:45+00:00","article_modified_time":"2017-08-01T20:18:31+00:00","author":"Lyubomir","twitter_card":"summary_large_image","twitter_creator":"@angelovcode","twitter_site":"@angelovcode","twitter_misc":{"Written by":"Lyubomir","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/#article","isPartOf":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/"},"author":{"name":"Lyubomir","@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92"},"headline":"How to use Amazon PHP AWS SDK","datePublished":"2017-08-01T08:39:45+00:00","dateModified":"2017-08-01T20:18:31+00:00","mainEntityOfPage":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/"},"wordCount":130,"commentCount":0,"publisher":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92"},"keywords":["amazon","php-aws-sdk","siege","xdebug"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/","url":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/","name":"How to use Amazon PHP AWS SDK - Lyubomir Angelov","isPartOf":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#website"},"datePublished":"2017-08-01T08:39:45+00:00","dateModified":"2017-08-01T20:18:31+00:00","breadcrumb":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/lyubomir-angelov.com\/blog\/how-to-use-amazon-php-aws-sdk\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/lyubomir-angelov.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to use Amazon PHP AWS SDK"}]},{"@type":"WebSite","@id":"https:\/\/lyubomir-angelov.com\/blog\/#website","url":"https:\/\/lyubomir-angelov.com\/blog\/","name":"Lyubomir Angelov","description":"The life of a Manager","publisher":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/lyubomir-angelov.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92","name":"Lyubomir","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g","caption":"Lyubomir"},"logo":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/twitter.com\/angelovcode"],"url":"https:\/\/lyubomir-angelov.com\/blog\/author\/superfly\/"}]}},"_links":{"self":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/posts\/18","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/comments?post=18"}],"version-history":[{"count":6,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/posts\/18\/revisions"}],"predecessor-version":[{"id":30,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/posts\/18\/revisions\/30"}],"wp:attachment":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/media?parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/categories?post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/tags?post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}