PHPackages                             kubotak-is/php-del - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kubotak-is/php-del

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kubotak-is/php-del
==================

Tool to remove code based on specific comments.

1.0.0(2y ago)1640.8k↓38.4%[4 issues](https://github.com/kubotak-is/php-del/issues)MITPHPPHP &gt;=8.0

Since Dec 2Pushed 2y ago2 watchersCompare

[ Source](https://github.com/kubotak-is/php-del)[ Packagist](https://packagist.org/packages/kubotak-is/php-del)[ RSS](/packages/kubotak-is-php-del/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (16)Used By (0)

PHP-DEL
=======

[](#php-del)

[![Unit Test](https://github.com/kubotak-is/php-del/actions/workflows/phpunit.yml/badge.svg?branch=main)](https://github.com/kubotak-is/php-del/actions/workflows/phpunit.yml)[![Latest Stable Version](https://camo.githubusercontent.com/016efabe423f1d969d6453b3b24715c8a6b1a3ea32c1e3565f780937b6a5cff2/687474703a2f2f706f7365722e707567782e6f72672f6b75626f74616b2d69732f7068702d64656c2f76)](https://packagist.org/packages/kubotak-is/php-del)[![PHP Version Require](https://camo.githubusercontent.com/790213c7cd3d1d46573323dfa151347abb68cf9112d9673f84681d5a345d7030/687474703a2f2f706f7365722e707567782e6f72672f6b75626f74616b2d69732f7068702d64656c2f726571756972652f706870)](https://packagist.org/packages/kubotak-is/php-del)[![License](https://camo.githubusercontent.com/c8bc39fc3953fcf91af748790990960ae4ff2c0d5480d09225eed77f9f344d97/687474703a2f2f706f7365722e707567782e6f72672f6b75626f74616b2d69732f7068702d64656c2f6c6963656e7365)](https://packagist.org/packages/kubotak-is/php-del)

Tool to remove code based on specific comments.

Install
-------

[](#install)

```
composer require --dev kubotak-is/php-del

```

Configuration
-------------

[](#configuration)

Create php-del.json in the root directory of the project

```
{
  "dirs": [
    "src"
  ],
  "extensions": [
    "php"
  ]
}
```

### dirs

[](#dirs)

Specify the directory to be searched for files.

### extensions(Optional: Default php)

[](#extensionsoptional-default-php)

Specify the extension to be searched.

Usage
-----

[](#usage)

Add a comment with a flag for code like the following

```
public function code() {
    /** php-del start flag-a */
    $something = 1;
    /** php-del end flag-a */
}
```

Run php-del from composer command.

```
/vendor/bin/php-del

```

Select the flag and enter to perform the deletion.

```
Finding flag...
Please choice me one of the following flag: (press  to select)
  ○ flag-a (1)

```

Deletion result

```
public function code() {
}
```

### One Line code delete

[](#one-line-code-delete)

To delete only one line.

```
use Hoge\Fuga\Piyo; // php-del line flag-a
```

### Codes not covered

[](#codes-not-covered)

The ignore comment can be added to remove it from the deletion list.

```
public function code() {
    /** php-del start flag-a */
    $something = 1;
    /** php-del ignore start */
    $ignore = 2;
    /** php-del ignore end */
    /** php-del end flag-a */
}
```

Deletion result

```
public function code() {
    $ignore = 2;
}
```

### File delete

[](#file-delete)

Deletes the file itself by adding a file deletion comment.

```
