Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sunrise-php/stream
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.9
Choose a base ref
...
head repository: sunrise-php/stream
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Nov 6, 2018

  1. Copy the full SHA
    1159eb0 View commit details
  2. Copy the full SHA
    7e652c5 View commit details

Commits on Nov 18, 2018

  1. Copy the full SHA
    effb7e2 View commit details

Commits on Dec 1, 2018

  1. Minor changes

    fenric committed Dec 1, 2018
    Copy the full SHA
    e597fc8 View commit details

Commits on Dec 11, 2018

  1. Minor changes

    fenric committed Dec 11, 2018
    Copy the full SHA
    35cea8f View commit details

Commits on Dec 12, 2018

  1. Copy the full SHA
    098cd88 View commit details

Commits on Dec 19, 2018

  1. Minor changes

    fenric committed Dec 19, 2018
    Copy the full SHA
    4377a84 View commit details
  2. Merge pull request #4 from sunrise-php/renovate/phpunit-phpunit-7.x

    Update dependency phpunit/phpunit to v7.5.1
    sunrise-php authored Dec 19, 2018
    Copy the full SHA
    9ad8432 View commit details
  3. Integration test

    fenric committed Dec 19, 2018
    Copy the full SHA
    f300669 View commit details

Commits on Dec 20, 2018

  1. Improved tests

    fenric committed Dec 20, 2018
    Copy the full SHA
    9f14522 View commit details

Commits on Dec 21, 2018

  1. Copy the full SHA
    b0ab080 View commit details

Commits on Jan 22, 2019

  1. Minor changes

    fenric committed Jan 22, 2019
    Copy the full SHA
    9c1d63d View commit details
  2. Minor changes

    fenric committed Jan 22, 2019
    Copy the full SHA
    7f1342e View commit details

Commits on Feb 7, 2019

  1. Copy the full SHA
    0baa9d4 View commit details

Commits on Feb 10, 2019

  1. Copy the full SHA
    d2b9c0b View commit details
  2. Merge pull request #5 from sunrise-php/renovate/phpunit-phpunit-7.x

    Update dependency phpunit/phpunit to v7.5.4
    fenric authored Feb 10, 2019
    Copy the full SHA
    0875c74 View commit details

Commits on Feb 18, 2019

  1. Copy the full SHA
    217da26 View commit details

Commits on Feb 21, 2019

  1. Test enhancement

    peter279k committed Feb 21, 2019
    Copy the full SHA
    45699b4 View commit details

Commits on Feb 22, 2019

  1. Merge pull request #7 from sunrise-php/renovate/phpunit-phpunit-7.x

    Update dependency phpunit/phpunit to v7.5.6
    fenric authored Feb 22, 2019
    Copy the full SHA
    bcdd227 View commit details
  2. Merge pull request #8 from peter279k/test_enhancement

    Test enhancement
    fenric authored Feb 22, 2019
    Copy the full SHA
    d6e2dd7 View commit details

Commits on Mar 5, 2019

  1. Update composer.json

    fenric committed Mar 5, 2019
    Copy the full SHA
    2e0744b View commit details
  2. Update README.md

    fenric committed Mar 5, 2019
    Copy the full SHA
    43fb91e View commit details

Commits on Dec 4, 2020

  1. minor changes

    fenric committed Dec 4, 2020
    Copy the full SHA
    db4df94 View commit details
  2. support php8

    fenric committed Dec 4, 2020
    Copy the full SHA
    b663fe4 View commit details
  3. cs fix

    fenric committed Dec 4, 2020
    Copy the full SHA
    2482da9 View commit details
  4. fix for php8

    fenric committed Dec 4, 2020
    Copy the full SHA
    a736dc0 View commit details
  5. Copy the full SHA
    6aa0e6d View commit details
  6. Copy the full SHA
    1b4a888 View commit details

Commits on Dec 25, 2020

  1. csf

    fenric committed Dec 25, 2020
    Copy the full SHA
    50492ab View commit details
  2. minor changes

    fenric committed Dec 25, 2020
    Copy the full SHA
    cab5974 View commit details
  3. new ignoring files

    fenric committed Dec 25, 2020
    Copy the full SHA
    142415e View commit details
  4. minor changes

    fenric committed Dec 25, 2020
    Copy the full SHA
    ddabe5f View commit details
  5. php8 support

    fenric committed Dec 25, 2020
    Copy the full SHA
    51bdf8c View commit details
  6. minor changes

    fenric committed Dec 25, 2020
    Copy the full SHA
    be0bb82 View commit details
  7. minor changes

    fenric committed Dec 25, 2020
    Copy the full SHA
    3d977ca View commit details
  8. minor changes

    fenric committed Dec 25, 2020
    Copy the full SHA
    4b3f112 View commit details
  9. minor changes

    fenric committed Dec 25, 2020
    Copy the full SHA
    9429107 View commit details
  10. Copy the full SHA
    409cad9 View commit details
  11. minor changes

    fenric committed Dec 25, 2020
    Copy the full SHA
    df538f9 View commit details
  12. minor changes

    fenric committed Dec 25, 2020
    Copy the full SHA
    1161b11 View commit details
  13. Copy the full SHA
    8ff4537 View commit details

Commits on Aug 5, 2021

  1. Copy the full SHA
    f58c567 View commit details
  2. Copy the full SHA
    ae3594e View commit details
  3. update README.md

    fenric committed Aug 5, 2021
    Copy the full SHA
    d5f0950 View commit details
  4. update composer.json

    fenric committed Aug 5, 2021
    Copy the full SHA
    e361ec8 View commit details
  5. update .scrutinizer.yml

    fenric committed Aug 5, 2021
    Copy the full SHA
    a7d720f View commit details
  6. Copy the full SHA
    535faf7 View commit details

Commits on Nov 30, 2021

  1. Improve PHPUnit assertions

    peter279k committed Nov 30, 2021
    Copy the full SHA
    985fe42 View commit details
  2. Merge pull request #20 from peter279k/improve_assertions

    Improve PHPUnit assertions
    fenric authored Nov 30, 2021
    Copy the full SHA
    4ce9d9c View commit details

Commits on Apr 19, 2022

  1. update .circleci/config.yml

    Анатолий Нехай committed Apr 19, 2022
    Copy the full SHA
    9e6fb39 View commit details
64 changes: 64 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
php71:
docker:
- image: cimg/php:7.1
steps:
- checkout
- run: php -v
- run: composer install --no-interaction
- run: XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text
php72:
docker:
- image: cimg/php:7.2
steps:
- checkout
- run: php -v
- run: composer install --no-interaction
- run: XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text
php73:
docker:
- image: cimg/php:7.3
steps:
- checkout
- run: php -v
- run: composer install --no-interaction
- run: XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text
php74:
docker:
- image: cimg/php:7.4
steps:
- checkout
- run: php -v
- run: composer install --no-interaction
- run: XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text
php80:
docker:
- image: cimg/php:8.0
steps:
- checkout
- run: php -v
- run: composer install --no-interaction
- run: XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text
php81:
docker:
- image: cimg/php:8.1
steps:
- checkout
- run: php -v
- run: composer install --no-interaction
- run: XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text
workflows:
version: 2
build:
jobs:
- php71
- php72
- php73
- php74
- php80
- php81
10 changes: 8 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# More info at:
# https://editorconfig.org/

root = true

[*.php]
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_size = 2
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
vendor/
composer.lock
/.php_cs.cache
/.phpunit.result.cache
/composer.lock
/coverage.xml
/phpbench.json
/phpcs.xml
/phpunit.xml
/psalm.xml
/vendor/
16 changes: 16 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
build:
environment:
php:
version: '8.0'
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
coverage:
tests:
override:
- command: XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-clover coverage.xml
coverage:
file: coverage.xml
format: clover
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Anatoly Fenric
Copyright (c) 2018 Anatoly Nekhay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
61 changes: 1 addition & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1 @@
# Stream wrapper for PHP 7.2+ based on PSR-7 & PSR-17

[![Build Status](https://api.travis-ci.com/sunrise-php/stream.svg?branch=master)](https://travis-ci.com/sunrise-php/stream)
[![CodeFactor](https://www.codefactor.io/repository/github/sunrise-php/stream/badge)](https://www.codefactor.io/repository/github/sunrise-php/stream)
[![Latest Stable Version](https://poser.pugx.org/sunrise/stream/v/stable)](https://packagist.org/packages/sunrise/stream)
[![Total Downloads](https://poser.pugx.org/sunrise/stream/downloads)](https://packagist.org/packages/sunrise/stream)
[![License](https://poser.pugx.org/sunrise/stream/license)](https://packagist.org/packages/sunrise/stream)

## Awards

[![SymfonyInsight](https://insight.symfony.com/projects/a6301a76-9b35-49a3-adb1-ebbf59f810f2/big.svg)](https://insight.symfony.com/projects/a6301a76-9b35-49a3-adb1-ebbf59f810f2)

## Installation

```
composer require sunrise/stream
```

## How to use?

```php
use Sunrise\Stream\Stream;
use Sunrise\Stream\StreamFactory;

// creates a new stream without a factory
$stream = new Stream(fopen(...));

// creates a new stream from the given string
$stream = (new StreamFactory)->createStream('Hello, world!');

// creates a new stream from the request body
$stream = (new StreamFactory)->createStreamFromRequestBody();

// creates a new stream from the given filename or URI
$stream = (new StreamFactory)->createStreamFromFile('http://php.net/', 'rb');

// creates a new stream from the given resource
$stream = (new StreamFactory)->createStreamFromResource(fopen(...));

// converts the stream to string
(string) $stream;

// closes the stream
$stream->close();
```

## Test run

```bash
php vendor/bin/phpunit
```

## Api documentation

https://phpdoc.fenric.ru/

## Useful links

https://www.php-fig.org/psr/psr-7/<br>
https://www.php-fig.org/psr/psr-17/
⚠️ This package was **moved** to the [http-message](https://github.com/sunrise-php/http-message) package and is abandoned.
78 changes: 55 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,57 @@
{
"name": "sunrise/stream",
"description": "Sunrise Stream",
"keywords": ["fenric", "sunrise", "stream", "psr-7", "psr-17"],
"homepage": "https://github.com/sunrise-php/stream",
"license": "MIT",
"authors": [{
"name": "Anatoly Fenric",
"email": "anatoly@fenric.ru",
"homepage": "https://anatoly.fenric.ru/"
}],
"require": {
"php": "^7.2",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "7.4.3"
},
"autoload": {
"psr-4": {
"Sunrise\\Stream\\": "src/"
}
}
"name": "sunrise/stream",
"homepage": "https://github.com/sunrise-php/stream",
"description": "Stream wrapper for PHP 7.1+ based on PSR-7 and PSR-17",
"license": "MIT",
"keywords": [
"fenric",
"sunrise",
"http",
"stream",
"psr-7",
"psr-17",
"php7",
"php8"
],
"authors": [
{
"name": "Anatoly Fenric",
"email": "afenric@gmail.com",
"homepage": "https://github.com/fenric"
},
{
"name": "李昀陞 (Peter)",
"email": "peter279k@gmail.com",
"homepage": "https://github.com/peter279k"
}
],
"provide": {
"psr/http-message-implementation": "1.0"
},
"require": {
"php": "^7.1|^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "7.5.20|9.5.0",
"sunrise/coding-standard": "1.0.0"
},
"autoload": {
"psr-4": {
"Sunrise\\Stream\\": "src/"
}
},
"scripts": {
"test": [
"phpcs",
"psalm",
"XDEBUG_MODE=coverage phpunit --coverage-text --colors=always"
],
"build": [
"phpdoc -d src/ -t phpdoc/",
"XDEBUG_MODE=coverage phpunit --coverage-html coverage/"
]
},
"abandoned": "sunrise/http-message"
}
7 changes: 7 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<ruleset name="Sunrise Coding Standard">
<rule ref="./vendor/sunrise/coding-standard/ruleset.xml"/>

<file>src</file>
<file>tests</file>
</ruleset>
22 changes: 15 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
<testsuites>
<testsuite name="Sunrise Stream Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="sunrise/stream">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
18 changes: 18 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<DocblockTypeContradiction errorLevel="info" />
</issueHandlers>
</psalm>
23 changes: 0 additions & 23 deletions src/Exception/Exception.php

This file was deleted.

18 changes: 0 additions & 18 deletions src/Exception/InvalidArgumentException.php

This file was deleted.

10 changes: 8 additions & 2 deletions src/Exception/UnopenableStreamException.php
Original file line number Diff line number Diff line change
@@ -11,8 +11,14 @@

namespace Sunrise\Stream\Exception;

/**
* Import classes
*/
use RuntimeException;

/**
* UnopenableStreamException
*/
class UnopenableStreamException extends Exception
{}
class UnopenableStreamException extends RuntimeException
{
}
Loading