├── .gitattributes ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml.dist ├── src └── Responses │ └── SlimResponseFactory.php └── tests ├── Responses └── SlimResponseFactoryTest.php └── kayaks.jpg /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | composer.lock 3 | vendor 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.5 5 | - 5.6 6 | - 7.0 7 | - hhvm 8 | 9 | sudo: false 10 | 11 | env: 12 | - COMPOSER_OPTS="" 13 | - COMPOSER_OPTS="--prefer-lowest" 14 | 15 | before_script: 16 | - travis_retry composer self-update 17 | - travis_retry composer update $COMPOSER_OPTS 18 | 19 | script: 20 | - php vendor/bin/phpunit -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jonathan Reinink 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Glide adapter for Slim 2 | 3 | [![Author](http://img.shields.io/badge/author-@reinink-blue.svg?style=flat-square)](https://twitter.com/reinink) 4 | [![Latest Version](https://img.shields.io/github/release/thephpleague/glide-slim.svg?style=flat-square)](https://github.com/thephpleague/glide-slim/releases) 5 | [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/thephpleague/glide-slim/blob/master/LICENSE) 6 | [![Build Status](https://img.shields.io/travis/thephpleague/glide-slim/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/glide-slim) 7 | [![HHVM Status](https://img.shields.io/hhvm/league/glide-slim.svg?style=flat-square)](http://hhvm.h4cc.de/package/league/glide-slim) 8 | [![Total Downloads](https://img.shields.io/packagist/dt/league/glide-slim.svg?style=flat-square)](https://packagist.org/packages/league/glide-slim) 9 | 10 | ## Installation 11 | 12 | ```bash 13 | $ composer require league/glide-slim 14 | ``` 15 | 16 | ## Documentation 17 | 18 | Full documentation can be found at [glide.thephpleague.com](http://glide.thephpleague.com). -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "league/glide-slim", 3 | "description": "Glide adapter for Slim", 4 | "homepage": "http://glide.thephpleague.com", 5 | "license": "MIT", 6 | "authors" : [ 7 | { 8 | "name": "Jonathan Reinink", 9 | "email": "jonathan@reinink.ca", 10 | "homepage": "http://reinink.ca" 11 | } 12 | ], 13 | "require": { 14 | "league/glide": "^1.0", 15 | "slim/slim": "^3.0" 16 | }, 17 | "require-dev": { 18 | "mockery/mockery": "^0.9", 19 | "phpunit/phpunit": "^4.0" 20 | }, 21 | "autoload": { 22 | "psr-4": { 23 | "League\\Glide\\": "src/" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | tests/ 6 | 7 | 8 | 9 | 10 | src/ 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Responses/SlimResponseFactory.php: -------------------------------------------------------------------------------- 1 | response = new Response(); 29 | $this->streamCallback = function ($stream) { 30 | return new Stream($stream); 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/Responses/SlimResponseFactoryTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf( 13 | 'League\Glide\Responses\SlimResponseFactory', 14 | new SlimResponseFactory() 15 | ); 16 | } 17 | 18 | public function testCreate() 19 | { 20 | $cache = new Filesystem( 21 | new Local(dirname(__DIR__)) 22 | ); 23 | 24 | $factory = new SlimResponseFactory(); 25 | $response = $factory->create($cache, 'kayaks.jpg'); 26 | 27 | $this->assertInstanceOf('Slim\Http\Response', $response); 28 | $this->assertEquals('image/jpeg', $response->getHeaderLine('Content-Type')); 29 | $this->assertEquals('5175', $response->getHeaderLine('Content-Length')); 30 | $this->assertContains(gmdate('D, d M Y H:i', strtotime('+1 years')), $response->getHeaderLine('Expires')); 31 | $this->assertEquals('max-age=31536000, public', $response->getHeaderLine('Cache-Control')); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/kayaks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thephpleague/glide-slim/9f5989b3c58c679174a0214f5fc934585a97abbf/tests/kayaks.jpg --------------------------------------------------------------------------------