Last active
June 8, 2019 04:39
-
-
Save codeitlikemiley/df3db9bc6588262735f4866089a92f93 to your computer and use it in GitHub Desktop.
Remove Block of Line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/composer.json b/composer.json | |
| index 8e2b2d7..38f96b4 100644 | |
| --- a/composer.json | |
| +++ b/composer.json | |
| @@ -15,9 +15,6 @@ | |
| }, | |
| "require-dev": { | |
| "beyondcode/laravel-dump-server": "^1.0", | |
| - "filp/whoops": "^2.0", | |
| - "fzaninotto/faker": "^1.4", | |
| - "mockery/mockery": "^1.0", | |
| "nunomaduro/collision": "^3.0", | |
| "phpunit/phpunit": "^7.5" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $path_to_file = base_path('composer.json'); | |
| // The Whole Content of composer.json | |
| $block_of_lines = file_get_contents($path_to_file); | |
| // List of composer packages | |
| $unwanted_words = array("filp/whoops", "fzaninotto/faker", "mockery/mockery"); | |
| $unwanted_words_match = '(?:' . join('|', array_map(function($word) { | |
| return preg_quote($word, '/'); | |
| }, $unwanted_words)) . ')'; | |
| $replace_match = '/^.*' . $unwanted_words_match . '.*$(?:\r\n|\n)?/m'; | |
| $result = preg_replace($replace_match, '', $block_of_lines); | |
| file_put_contents($path_to_file,$result); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment