Skip to content

Instantly share code, notes, and snippets.

@jakebathman
Last active November 12, 2025 21:40
Show Gist options
  • Save jakebathman/15010bcaa72d6d5232dd1c9c19c0a837 to your computer and use it in GitHub Desktop.
Save jakebathman/15010bcaa72d6d5232dd1c9c19c0a837 to your computer and use it in GitHub Desktop.

Revisions

  1. jakebathman revised this gist Nov 1, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion remove_laravel_comments.php
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,6 @@
    'public',
    'resources',
    'routes',
    'tests',
    ];

    $base = './';
  2. jakebathman revised this gist Nov 1, 2019. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions remove_laravel_comments.php
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    | Remove Laravel Comments
    |--------------------------------------------------------------------------
    |
    | Just made a new Laravel project, but don't want all those big
    | Just made a new Laravel project, but don't want all those big
    | comment blocks? Put this in the root of your project and run
    | "php remove_laravel_comments.php"
    |
    @@ -24,13 +24,13 @@
    $base = './';

    foreach ($directories as $dir) {
    $it = new RecursiveDirectoryIterator($base . $dir);
    foreach (new RecursiveIteratorIterator($it) as $file) {
    if ($file->getExtension() == 'php') {
    echo "Removing comments from: " . $file->getRealPath() . "\n";
    $contents = file_get_contents($file->getRealPath());
    $new = preg_replace('/^(\{?)\s*?\/\*(.|[\r\n])*?\*\/([\r\n]+$|$)/im', '$1', $contents);
    file_put_contents($file->getRealPath(), $new);
    $it = new RecursiveDirectoryIterator($base . $dir);
    foreach (new RecursiveIteratorIterator($it) as $file) {
    if ($file->getExtension() == 'php') {
    echo "Removing comments from: " . $file->getRealPath() . "\n";
    $contents = file_get_contents($file->getRealPath());
    $new = preg_replace('/^(\{?)\s*?\/\*(.|[\r\n])*?\*\/([\r\n]+$|$)/im', '$1', $contents);
    file_put_contents($file->getRealPath(), $new);
    }
    }
    }
    }
  3. jakebathman revised this gist May 17, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions remove_laravel_comments.php
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,7 @@
    'bootstrap',
    'config',
    'database',
    'public',
    'resources',
    'routes',
    'tests',
  4. jakebathman created this gist Apr 6, 2018.
    35 changes: 35 additions & 0 deletions remove_laravel_comments.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    <?php
    /*
    |--------------------------------------------------------------------------
    | Remove Laravel Comments
    |--------------------------------------------------------------------------
    |
    | Just made a new Laravel project, but don't want all those big
    | comment blocks? Put this in the root of your project and run
    | "php remove_laravel_comments.php"
    |
    */

    $directories = [
    'app',
    'bootstrap',
    'config',
    'database',
    'resources',
    'routes',
    'tests',
    ];

    $base = './';

    foreach ($directories as $dir) {
    $it = new RecursiveDirectoryIterator($base . $dir);
    foreach (new RecursiveIteratorIterator($it) as $file) {
    if ($file->getExtension() == 'php') {
    echo "Removing comments from: " . $file->getRealPath() . "\n";
    $contents = file_get_contents($file->getRealPath());
    $new = preg_replace('/^(\{?)\s*?\/\*(.|[\r\n])*?\*\/([\r\n]+$|$)/im', '$1', $contents);
    file_put_contents($file->getRealPath(), $new);
    }
    }
    }