base64_encode

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Encodes data with MIME base64
<?php base64_encode(string $string): string
<?php                 $response->sendContent();

            });



            $content = base64_encode($binary);



            $this->storeSet('download', [

                'name' => $name,
<?php     public static function generateHashNameWithOriginalNameEmbedded($file)

    {

        $hash = str()->random(30);

        $meta = str('-meta'.base64_encode($file->getClientOriginalName()).'-')->replace('/', '_');

        $extension = '.'.$file->guessExtension();



        return $hash.$meta.$extension;
<?php         $snapshot = app('livewire')->snapshot($container);



        $encoded = base64_encode(json_encode($snapshot));



        $placeholder = $this->getPlaceholderView($this->component, $params);
<?php         $serialized = serialize($value);



        return $this->connection instanceof PostgresConnection

            ? base64_encode($serialized)

            : $serialized;

    }
<?php         $result = serialize($value);



        if ($this->connection instanceof PostgresConnection && str_contains($result, "\0")) {

            $result = base64_encode($result);

        }



        return $result;
<?php             throw new EncryptException('Could not encrypt the data.');

        }



        $iv = base64_encode($iv);

        $tag = base64_encode($tag ?? '');



        $mac = self::$supportedCiphers[strtolower($this->cipher)]['aead']
<?php         }



        $iv = base64_encode($iv);

        $tag = base64_encode($tag ?? '');



        $mac = self::$supportedCiphers[strtolower($this->cipher)]['aead']

            ? '' // For AEAD-algorithms, the tag / MAC is returned by openssl_encrypt...
<?php             throw new EncryptException('Could not encrypt the data.');

        }



        return base64_encode($json);

    }
<?php         $this->components->info('Environment successfully encrypted.');



        $this->components->twoColumnDetail('Key', $keyPassed ? $key : 'base64:'.base64_encode($key));

        $this->components->twoColumnDetail('Cipher', $cipher);

        $this->components->twoColumnDetail('Encrypted file', $encryptedFile);
<?php     protected function generateRandomKey()

    {

        return 'base64:'.base64_encode(

            Encrypter::generateKey($this->laravel['config']['app.cipher'])

        );

    }
<?php     {

        $expiresAt = Carbon::now()->addHours(12);



        return new Cookie('laravel_maintenance', base64_encode(json_encode([

            'expires_at' => $expiresAt->getTimestamp(),

            'mac' => hash_hmac('sha256', $expiresAt->getTimestamp(), $key),

        ])), $expiresAt, config('session.path'), config('session.domain'));

    }
<?php     public function withBasicAuth(string $username, string $password)

    {

        return $this->withToken(base64_encode("$username:$password"), 'Basic');

    }
<?php         return [

            'sent' => $this->sent,

            'data' => $hasAttachments ? base64_encode(serialize($this->data)) : $this->data,

            'hasAttachments' => $hasAttachments,

        ];

    }
<?php         return [

            'hasAttachments' => $hasAttachments,

            'sentMessage' => $hasAttachments ? base64_encode(serialize($this->sentMessage)) : $this->sentMessage,

        ];

    }
<?php     public function encode()

    {

        return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(json_encode($this->toArray())));

    }