Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Encodes data with MIME base64
base64_encode(string $string): string
        $serialized serialize($value);



        return 
$this->connection instanceof PostgresConnection

            
base64_encode($serialized)

            : 
$serialized;

    }
        $result serialize($value);



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

            
$result base64_encode($result);

        }



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

        }



        
$iv base64_encode($iv);

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



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



        
$iv base64_encode($iv);

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



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

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

        }



        return 
base64_encode($json);

    }
    protected function generateRandomKey()

    {

        return 
'base64:'.base64_encode(

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

        );

    }
    {

        
$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),

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

    }
        $hasAttachments collect($this->message->getAttachments())->isNotEmpty();



        return 
$hasAttachments ? [

            
'sent' => base64_encode(serialize($this->sent)),

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

            
'hasAttachments' => true,

        ] : [
        return $hasAttachments ? [

            
'sent' => base64_encode(serialize($this->sent)),

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

            
'hasAttachments' => true,

        ] : [

            
'sent' => $this->sent,
    public function encode()

    {

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

    }
    protected function getDefaultPayload($data)

    {

        
$payload = [

            
'payload' => base64_encode($data),

            
'last_activity' => $this->currentTime(),

        ];
                $bytes random_bytes($size);



                
$string .= substr(str_replace(['/''+''='], ''base64_encode($bytes)), 0$size);

            }



            return 
$string;
        return [

            [
serialize($options), $options],

            [
base64_encode(serialize($options)), $options],

        ];

    }
        $table m::mock(stdClass::class);

        
$store->getConnection()->shouldReceive('table')->once()->with('table')->andReturn($table);

        
$table->shouldReceive('where')->once()->with('key''=''prefixfoo')->andReturn($table);

        
$table->shouldReceive('first')->once()->andReturn((object) ['value' => base64_encode(serialize('bar')), 'expiration' => 999999999999999]);



        
$this->assertSame('bar'$store->get('foo'));

    }
        $table m::mock(stdClass::class);

        
$store->getConnection()->shouldReceive('table')->once()->with('table')->andReturn($table);

        
$store->expects($this->once())->method('getTime')->willReturn(1);

        
$table->shouldReceive('insert')->once()->with(['key' => 'prefixfoo''value' => base64_encode(serialize("\0")), 'expiration' => 61])->andReturnTrue();



        
$result $store->put('foo'"\0"60);

        
$this->assertTrue($result);