Skip to content

Commit

Permalink
Release 5.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Denisyuk authored May 16, 2024
2 parents 0b27130 + 4c379e5 commit 66e36ef
Show file tree
Hide file tree
Showing 73 changed files with 1,501 additions and 926 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
/composer.lock export-ignore
/docs/ export-ignore
/phpunit.xml.dist export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
/tests/ export-ignore
34 changes: 12 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,74 @@ name: 'CI'
on:
push:
paths-ignore:
- 'build/**'
- 'docs/**'
- '.editorconfig'
- '.gitattributes'
- 'LICENSE'
- 'README.md'
pull_request:
paths-ignore:
- 'build/**'
- 'docs/**'
- '.editorconfig'
- '.gitattributes'
- 'LICENSE'
- 'README.md'

jobs:
parallel-lint:
name: 'ParallelLint'
runs-on: 'ubuntu-latest'

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: latest
php-version: '8.2'
coverage: none

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: Run PHPParallelLint
- name: Run ParallelLint
run: composer parallel-lint -- --no-progress --ignore-fails

psalm:
name: 'Psalm'
runs-on: 'ubuntu-latest'

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: latest
php-version: '8.2'
coverage: none

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: Run Psalm
run: composer psalm -- --no-progress --no-cache --output-format=github
run: composer psalm -- --show-info=false --no-progress --no-suggestions --no-cache

php-cs-fixer:
name: 'PHPCsFixer'
runs-on: 'ubuntu-latest'

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: latest
php-version: '8.2'
coverage: none

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: Run PHPCsFixer
run: composer php-cs-fixer:diff -- --no-interaction --using-cache=no

phpunit:
name: 'PHPUnit'
needs: ['parallel-lint', 'psalm', 'php-cs-fixer']
runs-on: ${{ matrix.operating-system }}

strategy:
fail-fast: false
matrix:
Expand All @@ -87,24 +80,21 @@ jobs:
php-version:
- '8.0'
- '8.1'
- '8.2'
composer-dependency:
- 'lowest'
- 'highest'

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none

- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.composer-dependency }}

- name: Run PHPUnit
run: composer phpunit -- --no-interaction --do-not-cache-result
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

$finder = (new PhpCsFixer\Finder())
->in([
__DIR__.'/src/',
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM php:8.2-cli

RUN \
apt-get update ; \
apt-get install -y unzip ; \
pecl install pcov ; \
docker-php-ext-enable pcov ;

COPY --from=composer:2.4 /usr/bin/composer /usr/local/bin/composer

WORKDIR /usr/local/packages/tmpfile-manager/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022 Aleksandr Denisyuk
Copyright (c) 2020 Aleksandr Denisyuk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
init:
docker build -t tmpfile-manager:8.2 ./

exec:
docker run --name tmpfile-manager --rm --interactive --tty --volume ${PWD}:/usr/local/packages/tmpfile-manager/ tmpfile-manager:8.2 /bin/bash
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# TmpFileManager

[![Build Status](https://img.shields.io/github/workflow/status/denisyukphp/tmpfile-manager/build/master?style=plastic)](https://github.com/denisyukphp/tmpfile-manager/actions/workflows/ci.yml)
[![Build Status](https://img.shields.io/github/actions/workflow/status/denisyukphp/tmpfile-manager/ci.yml?branch=master&style=plastic)](https://github.com/denisyukphp/tmpfile-manager/actions/workflows/ci.yml)
[![Latest Stable Version](https://img.shields.io/packagist/v/denisyukphp/tmpfile-manager?style=plastic)](https://packagist.org/packages/denisyukphp/tmpfile-manager)
[![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/denisyukphp/tmpfile-manager?style=plastic&color=8892BF)](https://packagist.org/packages/denisyukphp/tmpfile-manager)
[![Total Downloads](https://img.shields.io/packagist/dt/denisyukphp/tmpfile-manager?style=plastic)](https://packagist.org/packages/denisyukphp/tmpfile-manager)
[![License](https://img.shields.io/packagist/l/denisyukphp/tmpfile-manager?style=plastic&color=428F7E)](https://packagist.org/packages/denisyukphp/tmpfile-manager)

Temp files manager.
Temp file manager.

## Installation

Expand All @@ -20,36 +20,35 @@ This package requires PHP 8.0 or later.

## Quick usage

Configure TmpFileManager and create a temp file:
Build a temp file manager and create a temp file:

```php
<?php

use TmpFileManager\Config\Config;
use TmpFileManager\TmpFileManager;
use TmpFileManager\TmpFileManagerBuilder;
use TmpFile\TmpFileInterface;

$config = new Config(
tmpFileDirectory: sys_get_temp_dir(),
tmpFilePrefix: 'php',
);

$tmpFileManager = new TmpFileManager($config);
$tmpFileManager = (new TmpFileManagerBuilder())
->withTmpFileDir(sys_get_temp_dir())
->withTmpFilePrefix('php')
->build()
;

/** @var TmpFileInterface $tmpFile */
$tmpFile = $tmpFileManager->create();
```

All temp files which created with the manager will be purged automatically by default.
All temp files created the manager will be purged automatically by default.

## Documentation

- [Default configuration](docs/index.md#default-configuration)
- [Creating temp files](docs/index.md#creating-temp-files)
- [Loading temp files](docs/index.md#loading-temp-files)
- [Removing temp files](docs/index.md#removing-temp-files)
- [Auto-purging](docs/index.md#auto-purging)
- [Check unclosed resources](docs/index.md#check-unclosed-resources)
- [Garbage collection](docs/index.md#garbage-collection)
- [Custom handlers](docs/index.md#custom-handlers)
- [Subscribe events](docs/index.md#subscribe-events)
- [Lifecycle events](docs/index.md#lifecycle-events)

Read more about temp file on [Habr](https://habr.com/ru/post/320078/).
13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "denisyukphp/tmpfile-manager",
"description": "Temp files manager.",
"description": "Temp file manager.",
"keywords": [
"tmpfile",
"tempnam",
Expand All @@ -24,6 +24,7 @@
"require": {
"php": "^8.0",
"denisyukphp/tmpfile": "^3.0",
"psr/event-dispatcher": "^1.0",
"symfony/event-dispatcher": "^6.0",
"symfony/filesystem": "^6.0",
"symfony/finder": "^6.0",
Expand All @@ -49,12 +50,18 @@
},
"scripts": {
"phpunit": "./vendor/bin/phpunit --verbose --colors=always --no-coverage",
"phpunit:clear-cache": "rm ./build/cache/phpunit.cache",
"phpunit-coverage": "./vendor/bin/phpunit --verbose --colors=always --coverage-text",
"phpunit-coverage-html": "./vendor/bin/phpunit --verbose --colors=always --coverage-html ./build/logs/phpunit-coverage/",
"parallel-lint": "./vendor/bin/parallel-lint --colors ./src/ ./tests/",
"php-cs-fixer:fix": "./vendor/bin/php-cs-fixer fix --ansi --verbose --show-progress=dots",
"php-cs-fixer:diff": "./vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run --diff",
"php-cs-fixer:fix": "./vendor/bin/php-cs-fixer fix --verbose --ansi --show-progress=dots",
"php-cs-fixer:diff": "./vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --diff",
"php-cs-fixer:clear-cache": "rm ./build/cache/php-cs-fixer.cache",
"psalm": "./vendor/bin/psalm --show-info=true",
"psalm:clear-cache": "rm -rf ./build/cache/psalm/",
"psalm:set-baseline": "@psalm --set-baseline=./psalm-baseline.xml --no-cache",
"psalm:update-baseline": "@psalm --update-baseline --no-cache",
"psalm:ignore-baseline": "@psalm --ignore-baseline --no-cache",
"test": [
"@parallel-lint",
"@psalm",
Expand Down
Loading

0 comments on commit 66e36ef

Please sign in to comment.