Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3bcf60d
tmpdir and null safe strtolower
lachlan-00 Jun 2, 2026
30e8155
add phpstan
lachlan-00 Jun 3, 2026
dd00d87
start php8.0+
lachlan-00 Jun 3, 2026
21cc047
keep typing
lachlan-00 Jun 3, 2026
5656c79
phpstan clean for php8.0
lachlan-00 Jun 3, 2026
ada1ff7
work on tests
lachlan-00 Jun 4, 2026
4f7d1da
fix for tests
lachlan-00 Jun 4, 2026
810d015
Update CaptchaBuilder.php
lachlan-00 Jun 4, 2026
8678ef2
Merge pull request #1 from lachlan-00/php8
lachlan-00 Jun 4, 2026
8831ce2
send ints for typing error
lachlan-00 Jun 4, 2026
b22e385
convert has null output
lachlan-00 Jun 4, 2026
bac1d9e
Merge pull request #2 from lachlan-00/php8
lachlan-00 Jun 4, 2026
305c183
set default values for phrase properties
lachlan-00 Jun 4, 2026
03f5c5c
remove < 7.4 check
lachlan-00 Jun 4, 2026
a5abf50
inspection changes
lachlan-00 Jun 4, 2026
f059d1a
Merge branch 'php8'
lachlan-00 Jun 4, 2026
22c4f6a
copilot request comments
lachlan-00 Jun 4, 2026
6d639dd
Merge branch 'php8'
lachlan-00 Jun 4, 2026
da8a64f
strict comparison
lachlan-00 Jun 4, 2026
09e29bb
add version constant
lachlan-00 Jun 5, 2026
3dc8681
fileinfo included in newer php's
lachlan-00 Jun 5, 2026
4cf363b
require-dev squizlabs/php_codesniffer
lachlan-00 Jun 6, 2026
d1e66e4
8.5 is stable
lachlan-00 Jun 6, 2026
3b2267e
tempdir property and __construct order
lachlan-00 Jun 6, 2026
c65bfc7
semi revert gcfreq
lachlan-00 Jun 6, 2026
821ab9d
sort .gitignore
lachlan-00 Jun 6, 2026
323300d
restore ext-fileinfo
lachlan-00 Jun 6, 2026
5599757
Update composer.json
lachlan-00 Jun 6, 2026
f38e1de
Update phpunit.xml.dist
lachlan-00 Jun 6, 2026
003d11a
default values are already set for phrase builder
lachlan-00 Jun 6, 2026
b59bd2a
clear phpcs warnings for line length
lachlan-00 Jun 6, 2026
3348051
wip
bytestream Jun 7, 2026
c8e5c00
remove unused ImageFIleHandler
bytestream Jun 7, 2026
8962a6a
phpcbf
bytestream Jun 7, 2026
9d4bd7e
Clear php 8.5 errors
lachlan-00 Jun 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/demo/ export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
/demo/ export-ignore
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ['5.3.3', '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php: ['8.2', '8.3', '8.4', '8.5']

name: PHP ${{ matrix.php }}

Expand All @@ -31,15 +31,13 @@ jobs:

- name: Execute PHPCS
run: |
composer require "squizlabs/php_codesniffer=3.13.2"
./vendor/bin/phpcs --standard=PSR12 src/ tests/
if: ${{ matrix.php == '8.4' }}
if: ${{ matrix.php == '8.5' }}

- name: Execute PHPStan
run: |
composer require phpstan/phpstan:2.1.17 phpstan/phpstan-phpunit:2.0.6
./vendor/bin/phpstan analyse
if: ${{ matrix.php == '8.4' }}
if: ${{ matrix.php == '8.5' }}

- name: Execute tests
run: ./vendor/bin/phpunit
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.idea/
demo/*.jpg
demo/*.pgm
demo/temp/
vendor/
/.idea/
/.phpunit.result.cache
/composer.lock
/demo/*.jpg
/demo/*.pgm
/demo/temp/
/vendor/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ You can use these functions :
* **inline($quality = 80)**, returns the jpeg code directly in the HTML page
* **setBackgroundColor($r, $g, $b)**, sets the background color to force it (this will disable many effects and is not recommended)
* **setBackgroundAlpha($alpha)**, sets the background transparency 0 is fully opaque, 127 is fully transparent
* **setBackgroundImages(array($imagepath1, $imagePath2))**, Sets custom background images to be used as captcha background. It is recommended to disable image effects when passing custom images for background (ignore_all_effects). A random image is selected from the list passed, the full paths to the image files must be passed.
* **setBackgroundImages([$imagepath1, $imagePath2])**, Sets custom background images to be used as captcha background. It is recommended to disable image effects when passing custom images for background (ignore_all_effects). A random image is selected from the list passed, the full paths to the image files must be passed.
* **setInterpolation($interpolate)**, enable or disable the interpolation (enabled by default), disabling it will be quicker but the images will look uglier
* **setIgnoreAllEffects($ignoreAllEffects)**, disable all effects on the captcha image. Recommended to use when passing custom background images for the captcha.
* **testPhrase($phrase)**, returns true if the given phrase is good
Expand All @@ -101,7 +101,7 @@ You can use these functions :
* **setImageType($type)**, sets the image output type to "jpeg", "png" or "gif"
* **setScatterEffect($bool)**, enable or disable scatter effect (fuzzyness)

If you want to change the number of character, you can call the phrase builder directly using
If you want to change the number of characters, you can call the phrase builder directly using
extra parameters:

```php
Expand Down Expand Up @@ -135,13 +135,13 @@ render a captcha and check it after the submission
Symfony Bundle
================

You can have a look at the following repository to enjoy the Symfony 2 bundle packaging this captcha generator :
You can have a look at the following repository to enjoy the Symfony 2 bundle packaging this captcha generator:
https://github.com/Gregwar/CaptchaBundle

Yii2 Extension
===============

You can use the following extension for integrating with Yii2 Framework :
You can use the following extension for integrating with Yii2 Framework:
https://github.com/juliardi/yii2-captcha

License
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"require": {
"php": ">=5.3.0",
"php": "^8.2",
"ext-gd": "*",
"ext-mbstring": "*",
"ext-fileinfo": "*",
Comment thread
bytestream marked this conversation as resolved.
Expand All @@ -29,6 +29,9 @@
}
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6.4 || ^7.0 || ^8.0 || ^9.0"
"phpunit/phpunit": "^9.6",
"phpstan/phpstan": "2.1.17",
"squizlabs/php_codesniffer": "4.0.1",
"phpstan/phpstan-phpunit": "2.0.6"
}
}
14 changes: 6 additions & 8 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
includes:
- ./vendor/phpstan/phpstan-phpunit/extension.neon

parameters:
Comment thread
bytestream marked this conversation as resolved.
level: 5
paths:
- src/
- tests/
treatPhpDocTypesAsCertain: false
level: 8
reportUnmatchedIgnoredErrors: false
paths:
- src/
- tests/
treatPhpDocTypesAsCertain: false
24 changes: 11 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="KnpMenu Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
Loading