Coder Social home page Coder Social logo

jeskew / aws-sdk-php-silex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws/aws-sdk-php-silex

0.0 2.0 0.0 115 KB

Simple Silex service provider for including the AWS SDK for PHP

Home Page: http://aws.amazon.com/sdkforphp/

License: Apache License 2.0

PHP 100.00%

aws-sdk-php-silex's Introduction

AWS Service Provider for Silex

@awsforphp on Twitter Build Status Latest Stable Version Total Downloads

A simple Silex service provider for including the AWS SDK for PHP.

Installation

The AWS Service Provider can be installed via Composer by requiring the aws/aws-sdk-php-silex package in your project's composer.json.

{
    "require": {
        "aws/aws-sdk-php-silex": "~2.0"
    }
}

Usage

Register the AWS Service Provider in your Silex application and provide your AWS SDK for PHP configuration to the app in the aws.config key. $app['aws.config'] should contain an array of configuration options or the path to a configuration file. This value is passed directly into new Aws\Sdk.

<?php

require __DIR__ . '/vendor/autoload.php';

use Aws\Silex\AwsServiceProvider;
use Silex\Application;

$app = new Application();

$app->register(new AwsServiceProvider(), array(
    'aws.config' => array(
        'version' => 'latest',
        'region' => 'us-east-1',
    )
));
// Note: You can also specify a path to a config file
// (e.g., 'aws.config' => '/path/to/aws/config/file.php')

$app->match('/', function () use ($app) {
    // Get the Amazon S3 client
    $s3 = $app['aws']->createS3();

    // Create a list of the buckets in your account
    $output = "<ul>\n";
    foreach ($s3->getListBucketsIterator() as $bucket) {
        $output .= "<li>{$bucket['Name']}</li>\n";
    }
    $output .= "</ul>\n";

    return $output;
});

$app->run();

Links

aws-sdk-php-silex's People

Contributors

brendandixon avatar chh avatar davedevelopment avatar jeremeamia avatar jeskew avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.