file_get_contents

Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Reads entire file into a string
<?php file_get_contents(    string $filename,    bool $use_include_path = false,    ?resource $context = null,    int $offset = 0,    ?int $length = null): string|false
<?php     protected function emailOutput(Mailer $mailer, $addresses, $onlyIfOutputExists = false)

    {

        $text = is_file($this->output) ? file_get_contents($this->output) : '';



        if ($onlyIfOutputExists && empty($text)) {

            return;
<?php     protected function withOutputCallback(Closure $callback, $onlyIfOutputExists = false)

    {

        return function (Container $container) use ($callback, $onlyIfOutputExists) {

            $output = $this->output && is_file($this->output) ? file_get_contents($this->output) : '';



            return $onlyIfOutputExists && empty($output)

                            ? null
<?php     public function get($path, $lock = false)

    {

        if ($this->isFile($path)) {

            return $lock ? $this->sharedGet($path) : file_get_contents($path);

        }



        throw new FileNotFoundException("File does not exist at path {$path}.");
<?php     public function replaceInFile($search, $replace, $path)

    {

        file_put_contents($path, str_replace($search, $replace, file_get_contents($path)));

    }
<?php         }



        file_put_contents($path, $this->formatFacadeStub(

            $alias, file_get_contents(__DIR__.'/stubs/facade.stub')

        ));



        return $path;
<?php             return $this->namespace;

        }



        $composer = json_decode(file_get_contents($this->basePath('composer.json')), true);



        foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) {

            foreach ((array) $path as $pathChoice) {
<?php     protected function getOriginalFileForCompiledView($file)

    {

        preg_match('/\/\*\*PATH\s(.*)\sENDPATH/', file_get_contents($file), $matches);



        if (isset($matches[1])) {

            $file = $matches[1];
<?php     {

        $appBootstrapPath = $this->laravel->bootstrapPath('app.php');



        $content = file_get_contents($appBootstrapPath);



        if (str_contains($content, '// api: ')) {

            (new Filesystem)->replaceInFile(
<?php         }



        if (file_exists($bootstrapScriptPath = $this->laravel->resourcePath('js/bootstrap.js'))) {

            $bootstrapScript = file_get_contents(

                $bootstrapScriptPath

            );



            if (! str_contains($bootstrapScript, './echo')) {

                file_put_contents(
<?php             if (! str_contains($bootstrapScript, './echo')) {

                file_put_contents(

                    $bootstrapScriptPath,

                    trim($bootstrapScript.PHP_EOL.file_get_contents(__DIR__.'/stubs/echo-bootstrap-js.stub')).PHP_EOL,

                );

            }

        }
<?php     {

        $appBootstrapPath = $this->laravel->bootstrapPath('app.php');



        $content = file_get_contents($appBootstrapPath);



        if (str_contains($content, '// channels: ')) {

            (new Filesystem)->replaceInFile(
<?php             file_put_contents(

                storage_path('framework/maintenance.php'),

                file_get_contents(__DIR__.'/stubs/maintenance-mode.stub')

            );



            $this->laravel->get('events')->dispatch(new MaintenanceModeEnabled());
<?php         $replaced = preg_replace(

            $this->keyReplacementPattern(),

            'APP_KEY='.$key,

            $input = file_get_contents($this->laravel->environmentFilePath())

        );



        if ($replaced === $input || $replaced === null) {
<?php             if ((! $this->option('existing') && (! file_exists($to) || $this->option('force')))

                || ($this->option('existing') && file_exists($to))) {

                file_put_contents($to, file_get_contents($from));

            }

        }
<?php             $this->files->makeDirectory(dirname($path), 0755, true);

        }



        $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub'));

    }