Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $file = "app/config/app.php";
- $file_contents = file($file);
- $service_providers = <<<'SERVICE_PROVIDERS'
- 'Shoulderscms\Shoulderscms\ShoulderscmsServiceProvider', \n
- 'Lavary\Menu\ServiceProvider', \n
- 'Jaybizzle\Safeurl\SafeurlServiceProvider', \n
- SERVICE_PROVIDERS;
- $temp_file = fopen("app/config/app.temp.php");
- $write_the_providers = false;
- foreach($file_contents as $line){
- // We found the providers array declaration
- // Now write the service providers
- if($write_the_providers === true){
- fwrite($temp_file, $service_providers);
- $write_the_providers = false; // done writing the service providers
- continue;
- }
- //look for the declaration of the providers array
- if(substr($line, "'providers' => array(") !== false){
- // on the next line, we need to write the service providers lines
- $write_the_providers = true;
- }
- fwrite($temp_file, $line);
- }
- unlink($file);
- rename($temp_file, "app/config/app.php");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement