php-resque is a Redis-backed PHP library for creating background jobs, placing them on multiple queues, and processing them later.
This is a bundle to allow authentication into symfony >=2.1 by an Active directory
Thanks for your work, @PAXANDDOS! Concerning the supported configuration files, I saw that you deleted the config.yml
without a replacement. I'm wondering if this might impact the learning curve of new users. Maybe we should keep the file as reference and mention how different formats can be used in the docs? I'd prefer to have a simple out-of-the-box example configuration for basic use cases.
Ok, thank you very much @vtsykun
Thanks @vtsykun. Now the database looks good (null
), but in the JSON there are still entries with __unset
in the p2 JSON. Is this ok or should it also be null?
Works well so far. One thing we noticed: The dist
key contains null for the latest version of a package, but "__unset" for the other versions. Composer apparently ignores those values, but we're still wondering if this is the intended behavior.
Thanks!
Thanks for the fast response and fix, we'll test it :+1:
Hi @vtsykun and first of all, thanks for this great project!
We would like to use Packeton to manage our composer packages, but we do not need/want the zipball feature. Instead the applications should clone the packages directly from our GitLab server, ensuring authentication with the respective deploy keys.
After having a look at your documentation and code, we thought that the configuration option archive
should allow such behavior.
So we tried to set the configuration option archive
to false. However, now the Packeton application throws a RuntimeException
:
[Symfony\Component\DependencyInjection\Exception\RuntimeException]
You have requested a non-existent parameter "packeton_archive_opts". Did you mean this: "packeton_dumper_opts"?
This exception can be mitigated by changing Packeton\DependencyInjection\PacketonExtension
to initialize the packeton_archive_opts
:
[...]
if (true === $config['archive']) {
$container->setParameter('packeton_archive_opts', $config['archive_options'] ?? []);
} else {
$container->setParameter('packeton_archive_opts', []);
}
[...]
Now another exception is thrown:
[Symfony\Component\DependencyInjection\Exception\EnvParameterException]
Environment variables "PACKAGIST_DIST_HOST" are never used. Please, check your container's configuration.
We tried to fix the issues, but could not find a satisfactory solution yet.
If we add --prefer-source to the composer install
commands, we get the desired behavior for our internal packages.
However, we'd like to avoid changing all scripts where composer packages are installed. Furthermore, this is also applied to
external packages and therefore slows down the installation from packagist.org a lot.
How can we best achieve our goal (downloads only directly from the configured Git sources)?
Thank you very much, best regards
None
None
No response
Official docker image
feat: docker, tests, environment
refactor: codebase
TestCase
methods below now declare a void
return type:
setUpBeforeClass()
setUp()
assertPreConditions()
assertPostConditions()
tearDown()
tearDownAfterClass()
onNotSuccessfulTest()
[]
may be used instead of array()
refactor: cs-fixer
fix: speedtest command
fix: return code for Commands
fix/refactor: PHP 7.4 typed properties & arguments
chore: update Monolog to v2 (PHP 7.2+)
chore: bump Symfony components to ^5.4|^6.0
chore: PHP 7.4 migration
fix: return code for Clear command
Merge pull request #111 from PAXANDDOS/refactor/docker
Update codebase, bump Symfony components to ^5.4|^6.0, bump Monolog and more
| Q | A | | ------------- | ------------- | | Bug fix? | Yes | | New feature? | Yes (chores + Docker for development) | | Breaking changes? | Yes (PHP 7.4+, Symfony components 5.4.x, 6.x, Monolog 2.x, PHPUnit 9.x) | | Issues resolved | Fixes #104Fixes #105Fixes #108Fixes #110|
| Environment |
| -------- |
| Added Docker support with PHP 7.4
or any desired version. PHP version can be set in docker-compose
, default 7
(latest in 7.x). Pre-installed extensions: redis
, hiredis
, pcntl
, apcu
. Composer v2
. Available Redis v7
via docker-compose
. Usage explained [1] |
| Improved .editorconfig
|
| Improved .gitattributes
so code will always use LF |
| Fixes |
| -------- |
| Fixed speed:test
command error (passing a command as a string when creating a Process instance) |
| Fixed various TypeErrors
in commands (int code must be returned in execute() functions) |
| Fixed PHP deprecation of Serializable
interface, now using magic methods |
| Fixed "Not defined" errors, mainly with Logger
being used without a use
statement |
| Fixed return types in various functions, which caused intellisense errors[2] |
| Fixed return code for Clear command (return was only inside the if block) |
| Fixed incorrect type in ConsoleProcessor |
| Fixed deprecation (null passed to strpos) in Util.php |
| Code improvements |
| -------- |
| Add types to class properties where possible (PHP 7.4 feature - Typed Properties
). Some of the properties remain without the type because adding one will create execution errors[3]. All other properties - limited by PHP 7.4
, they can store multiple types but declaring union types is only possible in PHP 8.0+
, those properties only rely on DocBlocks
|
| Add return and argument types to functions where possible (limited by the PHP version mentioned above), improve DocBlocks
with correct types & union types |
| Add the final
keyword to a class where it applies |
| Remove unused use
statements and unused function parameters |
| Dependencies |
| -------- |
| Now application requires PHP version 7.4
and will work on versions up to 8.2
(see tests section below) |
| Updated Monolog
to ^2.5
(Monolog ^2.5 works with PHP 7.2 or above), all deprecations fixed. Version ^3.0
is not allowed because has some major changes |
| Updated PHPUnit
to ^9.0
, code and configuration updated. Using version ^10.0
is not possible |
| Updated Symfony Console
Process
Yaml
to version ^5.4 or ^6.0
, which means 5.4
would be installed on PHP 7.4
; 6.0
would be installed on PHP 8.0
; 6.1
would be installed on PHP 8.1
and so on. Versions 3.x
and 4.x
dropped completely because components of 6.0
version require each other of version not lower than 5.4
|
| Syntax improvements |
| -------- |
| Adopt short array syntax: Since PHP 5.4 the short array syntax []
may be used instead of array()
|
| Multi-line arrays, arguments list, parameters list, and match expressions must have a trailing comma |
| List (array destructuring) assignment should be declared using the configured syntax on PHP >= 7.1 |
| Heredoc/nowdoc content must be properly indented on PHP >= 7.3 |
| Visibility MUST be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility |
| Use null coalescing operator ?? where possible on PHP >= 7.0 |
| Add void return type to functions with missing or empty return statements, but priority is given to return
annotations on PHP >= 7.1 |
| Anonymous functions with one-liner return statements must use arrow functions |
| Master functions shall be used instead of aliases |
| Adjust spacing around the colon in return type declarations and backed enum types |
| All instances created with new keyword must be followed by braces |
| Equal sign in declare statement should be surrounded by spaces or not the following configuration |
During tests I used all possible methods:
composer test
bin/resque
except socket commands| PHP version | Dependencies | Status |
| -------- | -------- | -------- |
| PHP 7.4.33 | Predis v1.1.10
Monologv2.9.1
Symfony Console v5.4.19
Symfony Process v5.4.19
Symfony Yaml v5.4.19
| ✅ |
| PHP 8.0.28 | Predis v1.1.10
Monologv2.9.1
Symfony Console v6.0.19
Symfony Process v6.0.19
Symfony Yaml v6.0.19
| ✅ |
| PHP 8.1.16PHP 8.2.3 | Predis v1.1.10
Monologv2.9.1
Symfony Console v6.2.5
Symfony Process v6.2.5
Symfony Yaml v6.2.5
| ✅ |
| Number | Description|
| -------- | -------- |
| [1] | - Docker of the latest version must be installed.- Specify desired PHP version in docker-compose.yml
- Run docker compose up -d
at the root of the project- Run docker exec -it resque sh
to enter the container- Application is ready to use* start hosting Web UI cd examples
php -S 0.0.0.0:8000
and open the browser on localhost:8000
, port-forwarding specified in docker-compose.yml
* to use Redis from the container, change 127.0.0.1
in config to redis
, the hostname is the name of the service in docker-compose.yml
|
| [2] | For example, Job::push() had an annotation to return a string
, when in fact it was returning Job
instance. This made me confused when I was setting queue for my application |
| [3] | When type is defined, properties like, for example, Resque\Job::$worker
will cause execution error src\Resque\Job.php
on line 262 where setStatus()
is called. At this moment $worker
is not defined and without Typed Property will be mixed
for the compiler. When type is defined, throws an error: typed property $worker must not be accessed before initialization
|
And that's it. Also wanted to say that I like this library a lot and hoped to help to keep it maintained. Couldn't find many of the non-abandoned packages for the Redis queue out there, and yours has almost all of the features I needed! I've made a lot of changes, and hope documented them well; literally spent my whole weekend on this
Hi @PAXANDDOS! Thanks again for your PR. Your changes look good so far, I've created a v4 branch. Could you please change the target of the PR to that branch?
Best regards Andreas
Hi @PAXANDDOS! The usage of a v4 branch for now sounds like a great suggestion. At the moment I'm quite busy, so unfortunately I could not test the changes of your PR yet.
May I ask you how do you plan on releasing 2 versions simultaneously? I'm not familiar with the process thus I'm quite curious-- Would be
master
branch for v4 (for the latest release) l and a separate branch (3.x
) for the older one? Or would you go the Symfony way: no master branch at all, separate branch for each version (3.0
3.1
3.2
) and the latest release is the default branch? Also, I'd suggest making releases and not just tags (releases include tags)
I'd create a v3 branch for the older release and maintain v3 at least until the end of 2023, as we still have legacy systems which cannot be upgraded to PHP 7.4 at the moment. The master branch will get the latest v4 updates.
I'm so glad it was helpful! Although I didn't think of it as a major release at the start, for example, the difference between PHP 7.1 (your current minimum) and 7.4 is not so big. But yeah, drops of Monolog and Symfony components make me feel the need for that.
Yep, that's why a major version bump should be done IMHO :+1:
I just hope to see that v4 up quite soon smile As for 3.2.0, keep in mind that you might want to drop support for Symfony 3.x components. Because, for example, Process won't work on both of them (for 3.x constructor accepts string, for 4.x+ constructor accepts array)
For the Symfony Process compatibility I've already written a small factory class, which can be integrated here as well:
class ProcessFactory
{
public function createProcess($commandLine)
{
$sf42orHigher = method_exists(Process::class, 'fromShellCommandline');
return $sf42orHigher ? Process::fromShellCommandline($commandLine) : new Process($commandLine);
}
}
Furthermore, the speedtest and its symfony/process
requirement are optional, so I wouldn't drop SF3.4 compatibility just for the sake of it.
Wow, awesome work @PAXANDDOS, thank you very much :tada:! As there are quite some breaking changes (higher PHP requirement, Symfony and Monolog version bumps) I'd create a new major version v4, but nevertheless still maintain v3 for compatibility with legacy systems.
I'll review and test your new version, and apply some of your changes (parameter and return types where possible, new array syntax, code style improvements) to the upcoming v3 version 3.2.0 as well.
Hi @PAXANDDOS, thank you very much for your interest in php-resque and your issue(s). I didn't have time to test php-resque with Symfony 6.x yet, however I'm open to a PR. As you mentioned in https://github.com/mjphaynes/php-resque/issues/105, the process construction for the speed test would need to be changed, and the compatbility of the other used components (console, yaml) needs to be tested. Would you like to give it a try?
The solution of #78 and a possible PHP-only configuration would be great, but unfortunately I cannot create a new project in the mjphaynes namespace to enable such change.
Best regards Andreas
Thank you very much, @MiRacLe-RPZ
use date instead of deprecated strftime
use global constants (instead of Resque\SIGTERM...)
on empty queue blpop return null passed to strlen in removeNamespace method
prevent nullable $config['include'] pass to strlen
since php8.0 is_callable return false on non-static method
Deprecated: Implicit conversion from float 1674078723377.656 to int loses precision
bump version
revert "non-php8.x" change
use date instead of deprecated strftime
Merge pull request #103 from MiRacLe-RPZ/php81compat
Fix deprecation warnings on PHP 8.1
strftime
-> date
strlen($null)
-> !empty($null)
dechex($float)
-> dechex((int)$float)
remove is_callable(['classname', 'method'])
Also some minor fixes and bump staled Resque::VERSION
Aaah, I'm normally working on Gitlab... done thank you :+1: