Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?
  2. $file = "app/config/app.php";
  3. $file_contents = file($file);
  4.  
  5. $service_providers = <<<'SERVICE_PROVIDERS'
  6. 'Shoulderscms\Shoulderscms\ShoulderscmsServiceProvider', \n
  7. 'Lavary\Menu\ServiceProvider', \n
  8. 'Jaybizzle\Safeurl\SafeurlServiceProvider', \n
  9. SERVICE_PROVIDERS;
  10.  
  11. $temp_file = fopen("app/config/app.temp.php");
  12.  
  13. $write_the_providers = false;
  14.  
  15. foreach($file_contents as $line){
  16.  
  17. // We found the providers array declaration
  18. // Now write the service providers
  19. if($write_the_providers === true){
  20. fwrite($temp_file, $service_providers);
  21. $write_the_providers = false; // done writing the service providers
  22. continue;
  23. }
  24. //look for the declaration of the providers array
  25. if(substr($line, "'providers' => array(") !== false){
  26. // on the next line, we need to write the service providers lines
  27. $write_the_providers = true;
  28. }
  29. fwrite($temp_file, $line);
  30. }
  31.  
  32. unlink($file);
  33. rename($temp_file, "app/config/app.php");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement