Remove “require_once” from File

Remove “require_once” from File

Recently I had to remove the require_once’s from a legacy project, to switch completely to autoloading. Instead of doing it manually, I preferred to use sed (because we had a lot of files).

Here is the call, I used to do that:

Meaning: Find all PHP-files first, and execute sed (with inline-editing) which searched for the pattern, and removed the whole line.

Really easy, but yet powerful. You can adapt the pattern to get rid of other lines containing a particular pattern.

Please check the changes afterwards, to prevent bad surprises.