diff --git a/.docker/Dockerfile b/.docker/Dockerfile
new file mode 100644
index 0000000..5926dd2
--- /dev/null
+++ b/.docker/Dockerfile
@@ -0,0 +1,13 @@
+FROM php:8.2-cli-alpine AS final
+
+ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
+
+RUN install-php-extensions ctype curl intl json mbstring xml xdebug
+
+COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
+ENV COMPOSER_ALLOW_SUPERUSER=1
+
+WORKDIR /var/www/html
+
+# keep container up
+CMD ["php", "-S", "0.0.0.0:80", "-t", "./"]
diff --git a/.gitattributes b/.gitattributes
index aa29622..a2ccb9d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,10 +1,9 @@
+/.docker/ export-ignore
/.github/ export-ignore
-/docs/ export-ignore
/tests/ export-ignore
-.editorconfig export-ignore
+/.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
-.composer.lock export-ignore
-/grumphp.yml export-ignore
+/docker-compose.yaml export-ignore
/phpcs.xml export-ignore
/phpunit.xml.dist export-ignore
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..24a2c61
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,6 @@
+# These are supported funding model platforms
+
+github: [Erwane]
+liberapay: erwane
+buy_me_a_coffee: erwane
+thanks_dev: gh/erwane
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d651a6e..f84ce06 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- php-version: ['8.1', '8.3']
+ php-version: ['8.3', '8.5']
steps:
- uses: actions/checkout@v4
@@ -41,7 +41,7 @@ jobs:
env:
XDEBUG_MODE: coverage
run: |
- if [[ '${{ matrix.php-version }}' == '8.1' ]]; then
+ if [[ '${{ matrix.php-version }}' == '8.3' ]]; then
export CODECOVERAGE=1
vendor/bin/phpunit --display-warnings --display-incomplete --coverage-clover=coverage.xml
else
@@ -49,7 +49,7 @@ jobs:
fi
- name: Submit code coverage
- if: matrix.php-version == '8.1'
+ if: matrix.php-version == '8.3'
uses: codecov/codecov-action@v5
with:
files: coverage.xml
diff --git a/README.md b/README.md
index 6424e3a..19a6898 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
| 3.x | ^5.0 | PHP 8.1 |
## Description
-This is a really "simple to use" CakePHP plugin for generating and reading temporaries tokens
+This is a really "easy to use" CakePHP plugin for generating and reading temporaries tokens
## Installation
```bash
diff --git a/composer.json b/composer.json
index c3faae7..886c76c 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,10 @@
"name": "erwane/cakephp-token",
"description": "CakePHP plugin for tokens",
"type": "cakephp-plugin",
- "keywords": ["cakephp", "token"],
+ "keywords": [
+ "cakephp",
+ "token"
+ ],
"license": "MIT",
"authors": [
{
@@ -14,22 +17,19 @@
],
"support": {
"issues": "https://github.com/Erwane/cakephp-token/issues",
- "source": "https://github.com/Erwane/cakephp-token",
- "docs": "https://github.com/Erwane/cakephp-token/blob/master/README.md"
+ "source": "https://github.com/Erwane/cakephp-token"
},
"require": {
- "php": "^8.1",
+ "php": "^8.2",
"ext-json": "*",
- "cakephp/cakephp": "^5.0",
- "cakephp/migrations": "^4.0"
+ "cakephp/cakephp": "^5.3",
+ "cakephp/migrations": "^5.0"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^5.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
- "phpro/grumphp": "^2.0",
- "phpunit/phpunit": "^10.5.5 || ^11.1.3"
+ "phpunit/phpunit": "^11.1.3"
},
-
"autoload": {
"psr-4": {
"Token\\": "src/"
@@ -40,12 +40,10 @@
"Token\\Test\\": "tests/"
}
},
-
"scripts": {
"cscheck": "vendor/bin/phpcs -p src/ tests/",
"csfix": "vendor/bin/phpcbf -p src/ tests/"
},
-
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
diff --git a/config/Migrations/20160720184900_CreateTokens.php b/config/Migrations/20160720184900_CreateTokens.php
index e25bf50..49ed47f 100644
--- a/config/Migrations/20160720184900_CreateTokens.php
+++ b/config/Migrations/20160720184900_CreateTokens.php
@@ -5,13 +5,13 @@
*/
declare(strict_types=1);
-use Migrations\AbstractMigration;
-use Phinx\Db\Adapter\MysqlAdapter;
+use Migrations\BaseMigration;
+use Migrations\Db\Adapter\MysqlAdapter;
/**
* Class CreateTokens
*/
-class CreateTokens extends AbstractMigration
+class CreateTokens extends BaseMigration
{
public bool $autoId = false;
@@ -24,9 +24,13 @@ public function change(): void
{
$table = $this->table('token_tokens');
- $table->addColumn('id', 'string', ['limit' => 12, 'null' => false,])
+ $table
+ ->addColumn('id', 'string', ['limit' => 12, 'null' => false,])
->addColumn('scope', 'string', ['limit' => 50, 'default' => null, 'null' => true,])
- ->addColumn('scope_id', 'integer', ['signed' => false, 'limit' => MysqlAdapter::INT_REGULAR, 'default' => null, 'null' => true,])
+ ->addColumn(
+ 'scope_id', 'integer',
+ ['signed' => false, 'limit' => MysqlAdapter::INT_REGULAR, 'default' => null, 'null' => true,],
+ )
->addColumn('type', 'string', ['limit' => 64, 'null' => true,])
->addColumn('content', 'text', ['null' => true,])
->addColumn('expire', 'datetime', ['null' => false,])
diff --git a/config/Migrations/20170727143023_SimplifyTokens.php b/config/Migrations/20170727143023_SimplifyTokens.php
index 368ef15..25976f3 100644
--- a/config/Migrations/20170727143023_SimplifyTokens.php
+++ b/config/Migrations/20170727143023_SimplifyTokens.php
@@ -5,13 +5,13 @@
*/
declare(strict_types=1);
-use Migrations\AbstractMigration;
-use Phinx\Db\Adapter\MysqlAdapter;
+use Migrations\BaseMigration;
+use Migrations\Db\Adapter\MysqlAdapter;
/**
* Class SimplifyTokens
*/
-class SimplifyTokens extends AbstractMigration
+class SimplifyTokens extends BaseMigration
{
public bool $autoId = false;
@@ -43,7 +43,10 @@ public function down()
$table
->addColumn('scope', 'string', ['limit' => 50, 'default' => null, 'null' => true,])
- ->addColumn('scope_id', 'integer', ['signed' => false, 'limit' => MysqlAdapter::INT_REGULAR, 'default' => null, 'null' => true,])
+ ->addColumn(
+ 'scope_id', 'integer',
+ ['signed' => false, 'limit' => MysqlAdapter::INT_REGULAR, 'default' => null, 'null' => true,],
+ )
->addColumn('type', 'string', ['limit' => 64, 'null' => true,])
->addIndex(['scope', 'scope_id'])
->save();
diff --git a/config/Migrations/20190708113200_BinaryId.php b/config/Migrations/20190708113200_BinaryId.php
index 02f7c58..fa413f4 100644
--- a/config/Migrations/20190708113200_BinaryId.php
+++ b/config/Migrations/20190708113200_BinaryId.php
@@ -5,12 +5,12 @@
*/
declare(strict_types=1);
-use Migrations\AbstractMigration;
+use Migrations\BaseMigration;
/**
* Class BinaryId
*/
-class BinaryId extends AbstractMigration
+class BinaryId extends BaseMigration
{
/**
* Apply migrations
diff --git a/config/Migrations/20210406113200_IdLength.php b/config/Migrations/20210406113200_IdLength.php
index 82b64df..345fbac 100644
--- a/config/Migrations/20210406113200_IdLength.php
+++ b/config/Migrations/20210406113200_IdLength.php
@@ -5,12 +5,12 @@
*/
declare(strict_types=1);
-use Migrations\AbstractMigration;
+use Migrations\BaseMigration;
/**
* Class BinaryId
*/
-class IdLength extends AbstractMigration
+class IdLength extends BaseMigration
{
/**
* Apply migrations
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644
index 0000000..633cd4e
--- /dev/null
+++ b/docker-compose.yaml
@@ -0,0 +1,6 @@
+services:
+ php:
+ build:
+ ./.docker/
+ volumes:
+ - ".:/var/www/html"
diff --git a/phpcs.xml b/phpcs.xml
index a66f9b9..ddc806a 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -4,17 +4,16 @@
-
-
+ ./src
+ ./tests
- src/
- tests/
-
-
-
+
+
+ 0
+
0
diff --git a/src/Model/Table/TokensTable.php b/src/Model/Table/TokensTable.php
index 0ffe791..091af6f 100644
--- a/src/Model/Table/TokensTable.php
+++ b/src/Model/Table/TokensTable.php
@@ -82,7 +82,7 @@ public function read(string $id): ?Token
public function generate(
array $content = [],
DateTimeInterface|string|null $expire = null,
- int $tokenLength = 8
+ int $tokenLength = 8,
): string {
$entity = $this->newEntity([
'id' => $this->_uniqId($tokenLength),
diff --git a/src/Plugin.php b/src/TokenPlugin.php
similarity index 93%
rename from src/Plugin.php
rename to src/TokenPlugin.php
index 24dae19..6d48ae8 100644
--- a/src/Plugin.php
+++ b/src/TokenPlugin.php
@@ -22,6 +22,6 @@
*
* @package Token
*/
-class Plugin extends BasePlugin
+class TokenPlugin extends BasePlugin
{
}
diff --git a/tests/TestCase/MigrationsTest.php b/tests/TestCase/MigrationsTest.php
index 56cc165..1663015 100644
--- a/tests/TestCase/MigrationsTest.php
+++ b/tests/TestCase/MigrationsTest.php
@@ -80,6 +80,7 @@ public function testMigrations()
'length' => null,
'null' => false,
'default' => null,
+ 'onUpdate' => null,
'precision' => null,
'comment' => null,
],
@@ -88,6 +89,7 @@ public function testMigrations()
'length' => null,
'null' => false,
'default' => null,
+ 'onUpdate' => null,
'precision' => null,
'comment' => null,
],
@@ -95,7 +97,7 @@ public function testMigrations()
foreach ($columns as $name => $expected) {
$column = $schema->getColumn($name);
- $this->assertSame($column, $expected, "Field `$name`: comparison fail");
+ $this->assertEquals($column, $expected, "Field `$name`: comparison fail");
}
}
}