Giter VIP home page Giter VIP logo

facade's Introduction

Façade

Facade is an open-source library for memory-effecient consumption of stream-based protocols like HTTP.

Included is a streaming HTTP client and a streaming AWS S3 client. 99designs uses these to stream large designs from AWS to upstream clients without buffering the entire file in memory or on disk at any one time.

Examples

Streaming a file from disk to S3:

<?php

$s3 = new Facade_S3(getenv('AWS_ACCESS_KEY_ID'), getenv('AWS_SECRET_ACCESS_KEY'));
$file = '/uploads/largeimage.jpg';

$response = $s3
	->put("/llamas/largeimage.jpg")
	->setStream(Facade_Stream::fromFile($file))
	->setContentType('image/jpeg')
	->setHeader('Content-MD5: '.base64_encode(md5_file($file, true)))
	->send();

Streaming an S3 file to a client:

<?php

$s3 = new Facade_S3(getenv('AWS_ACCESS_KEY_ID'), getenv('AWS_SECRET_ACCESS_KEY'));

$response = $s3
  ->get('/llamas/largeimage.jpg')
  ->send();

stream_copy_to_stream($response->getStream(), STDOUT);

facade's People

Contributors

lox avatar

Stargazers

NOPMLLC avatar Brad Batt avatar Prof Syd Xu avatar Paul Dufour avatar Dinesh Kr. Choudhary avatar Martin Bazik avatar

Watchers

Paul Annesley avatar Andrew Krespanis avatar  avatar Alex Baldwin avatar Luke Cawood avatar Einar Valur Aðalsteinsson avatar David Lutz avatar Jamison avatar Chris Campbell avatar Michael De Wildt avatar James Cloos avatar Andrew Greig avatar Michael Tibben avatar Krystal Maria avatar Catherine Hills avatar  avatar Tom Broerse avatar  avatar Sheamus avatar  avatar Chris Tracey avatar Peter O'Dwyer avatar Dolphin Guy avatar David Lin avatar Sean avatar Judith Gammie avatar Alex Sonneveld avatar Jayden avatar  avatar Paul Liddelow avatar JUN HUANG avatar Justin LeFurjah  avatar  avatar Daniel Williams avatar Kerrison avatar  avatar  avatar  avatar  avatar Salaj Mithbawkar avatar  avatar Shaz avatar  avatar  avatar Megan Dell avatar  avatar NOPMLLC 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.