Skip to content

Commit b265d21

Browse files
committed
Merge commit 'f4d5ef05a08f520ecd3bc663a0b1ce421d1cbeca'
2 parents 73e5b88 + f4d5ef0 commit b265d21

File tree

11 files changed

+91
-108
lines changed

11 files changed

+91
-108
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: Install dependencies
3838
run: |
39-
composer require "symfony/http-foundation:${{ matrix.symfony }}" "symfony/http-kernel:${{ matrix.symfony }}" --no-interaction --no-update
39+
composer require "symfony/http-foundation:${{ matrix.symfony }}" --no-interaction --no-update
4040
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest --with-all-dependencies
4141
4242
- name: Execute Unit Tests

CHANGELOG.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
### Fixed
10+
### Changed since split from asm89/stack-cors
1111

12-
- Bug with `Access-Control-Allow-Origin` header is `null` then `allowedOrigins` is `['*']`, `supportsCredentials` is `true` and `Origin` header doesn't set (#85)
13-
14-
## [2.0.0] - 2020-05-11
15-
16-
### Added
17-
- CORS headers are better cachable now, with correct Vary headers (#70, #74)
18-
19-
### Changed
20-
- CORS headers are added to non-Origin requests when possible (#73)
21-
- Requests are no longer blocked by the server, only by the browser (#70)
12+
- Renamed Asm89\Stack namespace to Fruitcake\Cors
13+
- Removed HttpKernel middleware

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Copyright (c) 2013-2017 Alexander <iam.asm89@gmail.com>
2+
Copyright (c) 2017-2022 Barryvdh <barryvdh@gmail.com>
23

34
Permission is hereby granted, free of charge, to any person obtaining a copy
45
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# Stack/Cors
2+
## Stand-alone fork of https://github.com/asm89/stack-cors
3+
4+
[![Tests](https://github.com/fruitcake/php-cors/actions/workflows/run-tests.yml/badge.svg)](https://github.com/fruitcake/php-cors/actions/workflows/run-tests.yml)
5+
[![Packagist License](https://poser.pugx.org/fruitcake/php-corsr/license.png)](http://choosealicense.com/licenses/mit/)
6+
[![Latest Stable Version](https://poser.pugx.org/fruitcake/php-cors/version.png)](https://packagist.org/packages/fruitcake/php-cors)
7+
[![Total Downloads](https://poser.pugx.org/fruitcake/php-cors/d/total.png)](https://packagist.org/packages/fruitcake/php-cors)
8+
[![Fruitcake](https://img.shields.io/badge/Powered%20By-Fruitcake-b2bc35.svg)](https://fruitcake.nl/)
29

310
Library and middleware enabling cross-origin resource sharing for your
411
http-{foundation,kernel} using application. It attempts to implement the
@@ -10,13 +17,15 @@ Build status: ![.github/workflows/run-tests.yml](https://github.com/asm89/stack-
1017

1118
## Installation
1219

13-
Require `asm89/stack-cors` using composer.
20+
Require `fruitcake/php-cors` using composer.
1421

1522
## Usage
1623

17-
This package can be used as a library or as [stack middleware].
24+
This package can be used as a library. You can use it in your framework using:
1825

19-
[stack middleware]: http://stackphp.com/
26+
- [Stack middleware](http://stackphp.com/): https://github.com/asm89/stack-cors
27+
- [Laravel](https://laravel.com): https://github.com/fruitcake/laravel-cors
28+
2029

2130
### Options
2231

@@ -41,7 +50,7 @@ If `['*']` is provided to _allowedMethods_, _allowedOrigins_ or _allowedHeaders_
4150
```php
4251
<?php
4352

44-
use Asm89\Stack\CorsService;
53+
use Fruitcake\Cors\CorsService;
4554

4655
$cors = new CorsService([
4756
'allowedHeaders' => ['x-allowed-header', 'x-other-allowed-header'],
@@ -65,7 +74,7 @@ $cors->isPreflightRequest(Request $request);
6574
```php
6675
<?php
6776

68-
use Asm89\Stack\Cors;
77+
use Fruitcake\Cors\Cors;
6978

7079
$app = new Cors($app, [
7180
// you can use ['*'] to allow any headers
@@ -81,3 +90,9 @@ $app = new Cors($app, [
8190
'supportsCredentials' => false,
8291
]);
8392
```
93+
94+
## License
95+
96+
Released under the MIT License, see [LICENSE](LICENSE).
97+
The original author of this Library is Alexander <iam.asm89@gmail.com>, while Barry <barryvdh@gmail.com> has been involved since 2015.
98+
This package is split-off from https://github.com/asm89/stack-cors

composer.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
{
2-
"name": "asm89/stack-cors",
3-
"description": "Cross-origin resource sharing library and stack middleware",
4-
"keywords": ["stack", "cors"],
5-
"homepage": "https://github.com/asm89/stack-cors",
2+
"name": "fruitcake/php-cors",
3+
"description": "Cross-origin resource sharing library for the Symfony HttpFoundation",
4+
"keywords": ["cors", "symfony", "laravel"],
5+
"homepage": "https://github.com/fruitcake/php-cors",
66
"type": "library",
77
"license": "MIT",
88
"authors": [
99
{
10-
"name": "Alexander",
11-
"email": "iam.asm89@gmail.com"
10+
"name": "Barryvdh",
11+
"email": "barryvdh@gmail.com"
1212
}
1313
],
1414
"require": {
1515
"php": "^7.2|^8.0",
16-
"symfony/http-foundation": "^4|^5|^6",
17-
"symfony/http-kernel": "^4|^5|^6"
16+
"symfony/http-foundation": "^4|^5|^6"
1817
},
1918
"require-dev": {
2019
"phpunit/phpunit": "^7|^9",
2120
"squizlabs/php_codesniffer": "^3.5"
2221
},
2322
"autoload": {
2423
"psr-4": {
25-
"Asm89\\Stack\\": "src/"
24+
"Fruitcake\\Cors\\": "src/"
2625
}
2726
},
2827
"autoload-dev": {
2928
"psr-4": {
30-
"Asm89\\Stack\\Tests\\": "tests/"
29+
"Fruitcake\\Cors\\Tests\\": "tests/"
3130
}
3231
},
3332
"scripts": {
@@ -37,7 +36,7 @@
3736
},
3837
"extra": {
3938
"branch-alias": {
40-
"dev-master": "2.1-dev"
39+
"dev-master": "1.0-dev"
4140
}
4241
}
4342
}

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
stopOnFailure="false"
1111
>
1212
<testsuites>
13-
<testsuite name="Stack Cors Test Suite">
13+
<testsuite name="Fruitcake Cors Test Suite">
1414
<directory>./tests</directory>
1515
</testsuite>
1616
</testsuites>

src/Cors.php

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/CorsService.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php
22

33
/*
4-
* This file is part of asm89/stack-cors.
4+
* This file is part of fruitcake/php-cors and was originally part of asm89/stack-cors
55
*
66
* (c) Alexander <iam.asm89@gmail.com>
7+
* (c) Barryvdh <barryvdh@gmail.com>
78
*
89
* For the full copyright and license information, please view the LICENSE
910
* file that was distributed with this source code.
1011
*/
1112

12-
namespace Asm89\Stack;
13+
namespace Fruitcake\Cors;
1314

1415
use Symfony\Component\HttpFoundation\Request;
1516
use Symfony\Component\HttpFoundation\Response;

tests/CorsServiceTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<?php
22

33
/*
4-
* This file is part of asm89/stack-cors.
4+
* This file is part of fruitcake/php-cors and was originally part of asm89/stack-cors
55
*
66
* (c) Alexander <iam.asm89@gmail.com>
7+
* (c) Barryvdh <barryvdh@gmail.com>
78
*
89
* For the full copyright and license information, please view the LICENSE
910
* file that was distributed with this source code.
1011
*/
1112

12-
namespace Asm89\Stack\Tests;
13+
namespace Fruitcake\Cors\Tests;
1314

14-
use Asm89\Stack\CorsService;
15+
use Fruitcake\Cors\CorsService;
1516
use PHPUnit\Framework\TestCase;
1617

1718
class CorsServiceTest extends TestCase

tests/CorsTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22

33
/*
4-
* This file is part of asm89/stack-cors.
4+
* This file is part of fruitcake/php-cors and was originally part of asm89/stack-cors
55
*
66
* (c) Alexander <iam.asm89@gmail.com>
7+
* (c) Barryvdh <barryvdh@gmail.com>
78
*
89
* For the full copyright and license information, please view the LICENSE
910
* file that was distributed with this source code.
1011
*/
1112

12-
namespace Asm89\Stack\Tests;
13+
namespace Fruitcake\Cors\Tests;
1314

14-
use Asm89\Stack\Cors;
15-
use Asm89\Stack\CorsService;
15+
use Fruitcake\Cors\CorsService;
1616
use PHPUnit\Framework\TestCase;
1717
use Symfony\Component\HttpFoundation\Request;
1818
use Symfony\Component\HttpFoundation\Response;
@@ -24,7 +24,7 @@ class CorsTest extends TestCase
2424
*/
2525
public function it_does_modify_on_a_request_without_origin()
2626
{
27-
$app = $this->createStackedApp();
27+
$app = $this->createStackedApp();
2828

2929
$response = $app->handle(new Request());
3030

@@ -564,6 +564,6 @@ private function createStackedApp(array $options = array(), array $responseHeade
564564
$options
565565
);
566566

567-
return new Cors(new MockApp($responseHeaders), $passedOptions);
567+
return new MockApp($responseHeaders, $passedOptions);
568568
}
569569
}

0 commit comments

Comments
 (0)