Skip to content

Commit ce608b4

Browse files
committed
Merge branch 'release/3.0.0'
### Changed - 4cc83f1: Replace child process shutdown function and improve typings. - d6ecf04: Rebrand library to `phpfork`.
2 parents 29109b7 + e2ba975 commit ce608b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+278
-232
lines changed

.phan/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@
383383
// Thus, both first-party and third-party code being used by
384384
// your application should be included in this list.
385385
'directory_list' => [
386-
'src/Spork',
386+
'src',
387387
'vendor/symfony/event-dispatcher',
388388
'vendor/symfony/event-dispatcher-contracts',
389389
'vendor/symfony/var-dumper',

CHANGELOG.md

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

88
## [Unreleased]
99

10+
## [3.0.0] - 2020-02-02
11+
12+
### Changed
13+
14+
- 4cc83f1: Replace child process shutdown function and improve typings.
15+
- d6ecf04: Rebrand library to `phpfork`.
16+
1017
## [2.0.2] - 2020-02-02
1118

1219
### Changed
@@ -65,9 +72,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6572
- Added progress callbacks to Deferred.
6673
- Added serializable objects for exit and error messages.
6774

68-
[Unreleased]: https://github.com/TheLevti/spork/compare/2.0.2...HEAD
69-
[2.0.2]: https://github.com/TheLevti/spork/releases/2.0.2
70-
[2.0.1]: https://github.com/TheLevti/spork/releases/2.0.1
71-
[2.0.0]: https://github.com/TheLevti/spork/releases/2.0.0
72-
[1.0.0]: https://github.com/TheLevti/spork/releases/1.0.0
73-
[0.3.0]: https://github.com/TheLevti/spork/releases/0.3.0
75+
[Unreleased]: https://github.com/TheLevti/phpfork/compare/3.0.0...HEAD
76+
[3.0.0]: https://github.com/TheLevti/phpfork/releases/3.0.0
77+
[2.0.2]: https://github.com/TheLevti/phpfork/releases/2.0.2
78+
[2.0.1]: https://github.com/TheLevti/phpfork/releases/2.0.1
79+
[2.0.0]: https://github.com/TheLevti/phpfork/releases/2.0.0
80+
[1.0.0]: https://github.com/TheLevti/phpfork/releases/1.0.0
81+
[0.3.0]: https://github.com/TheLevti/phpfork/releases/0.3.0

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
**[Installation](#installation)** |
33
**[Usage](#usage)**
44

5-
# thelevti/spork
5+
# thelevti/phpfork
66

7-
[![Build Status](https://travis-ci.com/TheLevti/spork.svg?branch=master)](https://travis-ci.com/TheLevti/spork)
7+
[![Build Status](https://travis-ci.com/TheLevti/phpfork.svg?branch=master)](https://travis-ci.com/TheLevti/phpfork)
88

99
PHP on a fork.
1010

11-
`thelevti/spork` follows semantic versioning. Read more on [semver.org][1].
11+
`thelevti/phpfork` follows semantic versioning. Read more on [semver.org][1].
1212

1313
----
1414

@@ -29,21 +29,21 @@ To use this library through [composer][5], run the following terminal command
2929
inside your repository's root folder.
3030

3131
```sh
32-
composer require "thelevti/spork"
32+
composer require "thelevti/phpfork"
3333
```
3434

3535
## Usage
3636

37-
This library uses the namespace `Spork`.
37+
This library uses the namespace `Phpfork`.
3838

3939
```php
4040
<?php
4141

42-
$manager = new Spork\ProcessManager();
42+
$manager = new Phpfork\ProcessManager();
4343
$manager->fork(function () {
4444
// do something in another process!
4545
return 'Hello from ' . getmypid();
46-
})->then(function (Spork\Fork $fork) {
46+
})->then(function (Phpfork\Fork $fork) {
4747
// do something in the parent process when it's done!
4848
echo "{$fork->getPid()} says '{$fork->getResult()}'\n";
4949
});
@@ -60,7 +60,7 @@ multiple batches and spread them across many processes.
6060
$files = new RecursiveDirectoryIterator('/path/to/images');
6161
$files = new RecursiveIteratorIterator($files);
6262

63-
$manager = new Spork\ProcessManager();
63+
$manager = new Phpfork\ProcessManager();
6464
$manager->process($files, function(SplFileInfo $file) {
6565
// upload this file
6666
});
@@ -114,15 +114,15 @@ $callback = function ($value) use ($params) {
114114
$parentConnection = Doctrine\DBAL\DriverManager::getConnection($params);
115115
$parentConnection->connect();
116116

117-
$dispatcher = new Spork\EventDispatcher\EventDispatcher();
118-
$dispatcher->addListener(Spork\EventDispatcher\Events::PRE_FORK, function () use ($parentConnection) {
117+
$dispatcher = new Phpfork\EventDispatcher\EventDispatcher();
118+
$dispatcher->addListener(Phpfork\EventDispatcher\Events::PRE_FORK, function () use ($parentConnection) {
119119
$parentConnection->close();
120120
});
121121

122-
$manager = new Spork\ProcessManager($dispatcher, null, true);
122+
$manager = new Phpfork\ProcessManager($dispatcher, null, true);
123123

124-
/** @var Spork\Fork $fork */
125-
$fork = $manager->process($dataArray, $callback, new Spork\Batch\Strategy\ChunkStrategy($forks));
124+
/** @var Phpfork\Fork $fork */
125+
$fork = $manager->process($dataArray, $callback, new Phpfork\Batch\Strategy\ChunkStrategy($forks));
126126
$manager->wait();
127127

128128
$result = $fork->getResult();

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "thelevti/spork",
3-
"description": "PHP on a fork.",
2+
"name": "thelevti/phpfork",
3+
"description": "PHP process forking library.",
44
"type": "library",
55
"keywords": [
66
"php",
@@ -9,7 +9,7 @@
99
"async",
1010
"shmop"
1111
],
12-
"homepage": "https://github.com/TheLevti/spork",
12+
"homepage": "https://github.com/TheLevti/phpfork",
1313
"readme": "README.md",
1414
"license": "MIT",
1515
"authors": [
@@ -28,11 +28,11 @@
2828
],
2929
"support": {
3030
"email": "[email protected]",
31-
"issues": "https://github.com/TheLevti/spork/issues",
32-
"wiki": "https://github.com/TheLevti/spork/wiki",
33-
"source": "https://github.com/TheLevti/spork",
34-
"docs": "https://github.com/TheLevti/spork/blob/master/README.md",
35-
"rss": "https://github.com/TheLevti/spork/commits/master.atom"
31+
"issues": "https://github.com/TheLevti/phpfork/issues",
32+
"wiki": "https://github.com/TheLevti/phpfork/wiki",
33+
"source": "https://github.com/TheLevti/phpfork",
34+
"docs": "https://github.com/TheLevti/phpfork/blob/master/README.md",
35+
"rss": "https://github.com/TheLevti/phpfork/commits/master.atom"
3636
},
3737
"require": {
3838
"php": "^7.2.0",
@@ -51,18 +51,18 @@
5151
},
5252
"autoload": {
5353
"psr-4": {
54-
"Spork\\": "src/Spork/"
54+
"Phpfork\\": "src/"
5555
}
5656
},
5757
"autoload-dev": {
5858
"psr-4": {
59-
"Spork\\": "tests/Spork/"
59+
"Phpfork\\": "tests/"
6060
}
6161
},
6262
"suggest": {
6363
"ext-pnctl": "To allow this library forking processes.",
6464
"ext-posix": "To allow this library getting process information.",
65-
"ext-shmop": "To allow this library doing interprocess communication."
65+
"ext-shmop": "To allow this library doing inter-process communication."
6666
},
6767
"archive": {
6868
"exclude": [

phpunit.xml.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.4/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
44
backupGlobals="false"
55
backupStaticAttributes="false"
66
bootstrap="vendor/autoload.php"
@@ -11,13 +11,13 @@
1111
processIsolation="false"
1212
stopOnFailure="false">
1313
<testsuites>
14-
<testsuite name="Spork Test Suite">
14+
<testsuite name="Phpfork Test Suite">
1515
<directory suffix="Test.php">./tests</directory>
1616
</testsuite>
1717
</testsuites>
1818
<filter>
1919
<whitelist processUncoveredFilesFromWhitelist="true">
20-
<directory suffix=".php">./src/Spork</directory>
20+
<directory suffix=".php">./src</directory>
2121
</whitelist>
2222
</filter>
2323
</phpunit>

src/Spork/Batch/BatchJob.php renamed to src/Batch/BatchJob.php

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

33
/*
4-
* This file is part of Spork, an OpenSky project.
4+
* This file is part of the thelevti/phpfork package.
55
*
6-
* (c) OpenSky Project Inc
6+
* (c) Petr Levtonov <[email protected]>
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Spork\Batch;
12+
declare(strict_types=1);
1313

14-
use Spork\Batch\Strategy\ChunkStrategy;
15-
use Spork\Batch\Strategy\StrategyInterface;
16-
use Spork\Exception\UnexpectedTypeException;
17-
use Spork\ProcessManager;
14+
namespace Phpfork\Batch;
15+
16+
use Phpfork\Batch\Strategy\ChunkStrategy;
17+
use Phpfork\Batch\Strategy\StrategyInterface;
18+
use Phpfork\Exception\UnexpectedTypeException;
19+
use Phpfork\ProcessManager;
1820

1921
class BatchJob
2022
{

src/Spork/Batch/BatchRunner.php renamed to src/Batch/BatchRunner.php

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

33
/*
4-
* This file is part of Spork, an OpenSky project.
4+
* This file is part of the thelevti/phpfork package.
55
*
6-
* (c) OpenSky Project Inc
6+
* (c) Petr Levtonov <[email protected]>
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Spork\Batch;
12+
declare(strict_types=1);
1313

14-
use Spork\Exception\UnexpectedTypeException;
15-
use Spork\SharedMemory;
14+
namespace Phpfork\Batch;
15+
16+
use Phpfork\Exception\UnexpectedTypeException;
17+
use Phpfork\SharedMemory;
1618

1719
class BatchRunner
1820
{

src/Spork/Batch/Strategy/AbstractStrategy.php renamed to src/Batch/Strategy/AbstractStrategy.php

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

33
/*
4-
* This file is part of Spork, an OpenSky project.
4+
* This file is part of the thelevti/phpfork package.
55
*
6-
* (c) OpenSky Project Inc
6+
* (c) Petr Levtonov <[email protected]>
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Spork\Batch\Strategy;
12+
declare(strict_types=1);
1313

14-
use Spork\Batch\BatchRunner;
14+
namespace Phpfork\Batch\Strategy;
15+
16+
use Phpfork\Batch\BatchRunner;
1517

1618
abstract class AbstractStrategy implements StrategyInterface
1719
{

src/Spork/Batch/Strategy/CallbackStrategy.php renamed to src/Batch/Strategy/CallbackStrategy.php

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

33
/*
4-
* This file is part of Spork, an OpenSky project.
4+
* This file is part of the thelevti/phpfork package.
55
*
6-
* (c) OpenSky Project Inc
6+
* (c) Petr Levtonov <[email protected]>
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Spork\Batch\Strategy;
12+
declare(strict_types=1);
1313

14-
use Spork\Exception\UnexpectedTypeException;
14+
namespace Phpfork\Batch\Strategy;
15+
16+
use Phpfork\Exception\UnexpectedTypeException;
1517

1618
class CallbackStrategy extends AbstractStrategy
1719
{

src/Spork/Batch/Strategy/ChunkStrategy.php renamed to src/Batch/Strategy/ChunkStrategy.php

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

33
/*
4-
* This file is part of Spork, an OpenSky project.
4+
* This file is part of the thelevti/phpfork package.
55
*
6-
* (c) OpenSky Project Inc
6+
* (c) Petr Levtonov <[email protected]>
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Spork\Batch\Strategy;
12+
declare(strict_types=1);
1313

14-
use Spork\Exception\UnexpectedTypeException;
14+
namespace Phpfork\Batch\Strategy;
15+
16+
use Phpfork\Exception\UnexpectedTypeException;
1517

1618
/**
1719
* Creates the batch iterator using array_chunk().

src/Spork/Batch/Strategy/StrategyInterface.php renamed to src/Batch/Strategy/StrategyInterface.php

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

33
/*
4-
* This file is part of Spork, an OpenSky project.
4+
* This file is part of the thelevti/phpfork package.
55
*
6-
* (c) OpenSky Project Inc
6+
* (c) Petr Levtonov <[email protected]>
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Spork\Batch\Strategy;
12+
declare(strict_types=1);
13+
14+
namespace Phpfork\Batch\Strategy;
1315

1416
/**
1517
* @see BatchJob::__invoke()

src/Spork/Batch/Strategy/ThrottleStrategy.php renamed to src/Batch/Strategy/ThrottleStrategy.php

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

33
/*
4-
* This file is part of Spork, an OpenSky project.
4+
* This file is part of the thelevti/phpfork package.
55
*
6-
* (c) OpenSky Project Inc
6+
* (c) Petr Levtonov <[email protected]>
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Spork\Batch\Strategy;
12+
declare(strict_types=1);
1313

14-
use Spork\Util\ThrottleIterator;
14+
namespace Phpfork\Batch\Strategy;
15+
16+
use Phpfork\Util\ThrottleIterator;
1517

1618
class ThrottleStrategy implements StrategyInterface
1719
{

src/Spork/Deferred/Deferred.php renamed to src/Deferred/Deferred.php

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

33
/*
4-
* This file is part of Spork, an OpenSky project.
4+
* This file is part of the thelevti/phpfork package.
55
*
6-
* (c) OpenSky Project Inc
6+
* (c) Petr Levtonov <[email protected]>
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Spork\Deferred;
12+
declare(strict_types=1);
1313

14-
use Spork\Exception\UnexpectedTypeException;
14+
namespace Phpfork\Deferred;
15+
16+
use Phpfork\Exception\UnexpectedTypeException;
1517

1618
class Deferred implements DeferredInterface
1719
{

0 commit comments

Comments
 (0)