Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .laminas-ci.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ignore_php_platform_requirements": {
"8.4": true
"8.5": true
},
"backwardCompatibilityCheck": true
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Documentation is available at: https://docs.dotkernel.org/dot-cli/.
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-cli)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-cli/3.9.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-cli/3.10.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-cli)](https://github.com/dotkernel/dot-cli/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-cli)](https://github.com/dotkernel/dot-cli/network)
Expand All @@ -24,7 +24,7 @@ Documentation is available at: https://docs.dotkernel.org/dot-cli/.

## Requirements

- **PHP**: 8.2, 8.3 or 8.4
- **PHP**: 8.2, 8.3, 8.4 or 8.5
- **laminas/laminas-servicemanager**: >= 3.11 || >= 4.0,
- **laminas/laminas-cli**: >= 1.4

Expand Down Expand Up @@ -91,7 +91,7 @@ Available commands:
As shown in `config/autoload/cli.global.php`, dot-cli includes a demo command `demo:command` that will help you understand the basics of creating a new command.
For more information, see [laminas-cli documentation](https://docs.laminas.dev/laminas-cli/).

## Setting up as cronjob
## Setting up as a cronjob

```text
* * * * * /opt/plesk/php/7.4/bin/php /var/www/vhosts/example.com/httpdocs/bin/cli.php demo:command -q
Expand Down
8 changes: 4 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## Supported Versions


| Version | Supported | PHP Version |
|---------|--------------------|---------------------------------------------------------------------------------------------------------|
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-cli/3.4.2) |
| <= 2.x | :x: | |
| Version | Supported | PHP Version |
|---------|--------------------|----------------------------------------------------------------------------------------------------------|
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-cli/3.10.0) |
| <= 2.x | :x: | |


## Reporting Potential Security Issues
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
},
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"laminas/laminas-cli": "^1.4.0",
"laminas/laminas-servicemanager": "^3.11.1 || ^4.0"
},
Expand All @@ -35,8 +35,8 @@
"require-dev": {
"laminas/laminas-coding-standard": "^3.0",
"mikey179/vfsstream": "^1.6.7",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan": "^2.1.17",
"phpstan/phpstan-phpunit": "^2.0.6",
"phpunit/phpunit": "^10.2"
},
"autoload-dev": {
Expand All @@ -52,7 +52,8 @@
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"static-analysis": "phpstan analyse --memory-limit 1G",
"test": "phpunit --colors=always",
"static-analysis": "phpstan analyse --memory-limit 1G"
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}
8 changes: 2 additions & 6 deletions docs/book/v3/overview.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Overview

Dotkernel component to build console applications based on [laminas-cli](https://github.com/laminas/laminas-cli).

> [!IMPORTANT]
> dot-cli is a wrapper on top of [laminas-cli](https://github.com/laminas/laminas-cli)

## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-cli)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-cli/3.9.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-cli/3.10.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-cli)](https://github.com/dotkernel/dot-cli/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-cli)](https://github.com/dotkernel/dot-cli/network)
Expand All @@ -16,4 +13,3 @@ Dotkernel component to build console applications based on [laminas-cli](https:/

[![Build Static](https://github.com/dotkernel/dot-cli/actions/workflows/continuous-integration.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-cli/actions/workflows/continuous-integration.yml)
[![codecov](https://codecov.io/gh/dotkernel/dot-cli/graph/badge.svg?token=0DFCK2GUBT)](https://codecov.io/gh/dotkernel/dot-cli)
[![PHPStan](https://github.com/dotkernel/dot-cli/actions/workflows/static-analysis.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-cli/actions/workflows/static-analysis.yml)
2 changes: 1 addition & 1 deletion docs/book/v3/setting-up-as-cronjob.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Setting up as cronjob
# Setting up as a cronjob

```text
* * * * * php /var/www/vhosts/example.com/httpdocs/bin/cli.php demo:command -q
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v3/usage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Usage

Use `src/Command/DemoCommand.php` as an example when creating a new command.
Update the name & description in the `AsCommand` attribute as needed.
Update the name and description in the `AsCommand` attribute as needed.
Also update the `$defaultName` property and the description set inside the `configure` method to match the `AsCommand` attribute.

## Running
Expand Down
2 changes: 1 addition & 1 deletion test/Command/DemoCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DemoCommandTest extends TestCase
public function testWillCreateCommand(): void
{
$command = new DemoCommand();
$this->assertSame(DemoCommand::class, $command::class);
$this->assertContainsOnlyInstancesOf(DemoCommand::class, [$command]);
}

/**
Expand Down
32 changes: 16 additions & 16 deletions test/FileLockerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,28 @@ public function testAccessors(): void
$fileLocker = new FileLocker();
$this->assertFalse($fileLocker->isEnabled());
$fileLocker->enable();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertTrue($fileLocker->isEnabled());
$fileLocker->disable();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertFalse($fileLocker->isEnabled());
$fileLocker->setEnabled(true);
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertTrue($fileLocker->isEnabled());
$fileLocker->setEnabled(false);
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertFalse($fileLocker->isEnabled());
$this->assertNull($fileLocker->getDirPath());
$fileLocker->setDirPath('test');
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertSame('test', $fileLocker->getDirPath());
$this->assertNull($fileLocker->getCommandName());
$fileLocker->setCommandName('test');
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertSame('test', $fileLocker->getCommandName());
$this->assertNull($fileLocker->getLockFile());
$fileLocker->setLockFile('test');
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertSame('test', $fileLocker->getLockFile());
$this->assertSame('test/command-test.lock', $fileLocker->getLockFilePath());
}
Expand All @@ -65,7 +65,7 @@ public function testWillInitLockFile(): void
$fileLocker = new FileLocker(true, $config['dirPath'], 'test');
$this->assertNull($fileLocker->getLockFile());
$fileLocker->initLockFile();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertIsResource($fileLocker->getLockFile());
}

Expand All @@ -79,7 +79,7 @@ public function testWillNotLockWhenDisabled(): void
$fileLocker = new FileLocker(false, $config['dirPath'], 'test');
$this->assertNull($fileLocker->getLockFile());
$fileLocker->lock();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertNull($fileLocker->getLockFile());
}

Expand All @@ -93,7 +93,7 @@ public function testWillNotLockWithoutValidCommandName(): void
$fileLocker = new FileLocker(true, $config['dirPath']);
$this->assertNull($fileLocker->getLockFile());
$fileLocker->lock();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertNull($fileLocker->getLockFile());
}

Expand All @@ -107,7 +107,7 @@ public function testWillLockWhenLockedAndEnabledAndHasValidCommandName(): void
$fileLocker = new FileLocker(true, $config['dirPath'], 'test');
$this->assertNull($fileLocker->getLockFile());
$fileLocker->lock();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertIsResource($fileLocker->getLockFile());
$this->assertFileExists($fileLocker->getLockFilePath());
}
Expand All @@ -119,7 +119,7 @@ public function testWillNotUnlockWhenDisabled(): void
$fileLocker = new FileLocker(false, $config['dirPath'], 'test');
$this->assertNull($fileLocker->getLockFile());
$fileLocker->unlock();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertNull($fileLocker->getLockFile());
}

Expand All @@ -130,7 +130,7 @@ public function testWillNotUnlockWithoutValidCommandName(): void
$fileLocker = new FileLocker(false, $config['dirPath']);
$this->assertNull($fileLocker->getLockFile());
$fileLocker->unlock();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertNull($fileLocker->getLockFile());
}

Expand All @@ -141,7 +141,7 @@ public function testWillNotUnlockWhenEnabledAndWithoutValidCommandName(): void
$fileLocker = new FileLocker(true, $config['dirPath']);
$this->assertNull($fileLocker->getLockFile());
$fileLocker->unlock();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertNull($fileLocker->getLockFile());
}

Expand All @@ -154,11 +154,11 @@ public function testWillUnlockWhenLockedAndEnabledAndHasValidCommandName(): void

$fileLocker = new FileLocker(true, $config['dirPath'], 'test');
$fileLocker->lock();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertIsResource($fileLocker->getLockFile());
$this->assertFileExists($fileLocker->getLockFilePath());
$fileLocker->unlock();
$this->assertSame(FileLocker::class, $fileLocker::class);
$this->assertContainsOnlyInstancesOf(FileLocker::class, [$fileLocker]);
$this->assertFileIsReadable($fileLocker->getLockFilePath());
$this->assertFileIsWritable($fileLocker->getLockFilePath());
}
Expand Down