Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Encodes data with MIME base64
<?php base64_encode(string $string): string
<?php         }



        if ($this->apcu) {

            $apcuPrefix = var_export(($this->apcuPrefix !== null ? $this->apcuPrefix : substr(base64_encode(md5(uniqid('', true), true)), 0, -3)), true);

            $file .= <<<APCU

        \$loader->setApcuPrefix($apcuPrefix);
<?php                     $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';

                }

            } else {

                $authStr = base64_encode($auth['username'] . ':' . $auth['password']);

                $headers[] = 'Authorization: Basic '.$authStr;

                $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';

            }
<?php             if (isset($proxy['pass'])) {

                $auth .= ':' . rawurldecode($proxy['pass']);

            }

            $auth = base64_encode($auth);


            $options['http']['header'] = "Proxy-Authorization: Basic {$auth}";

        }
<?php                     $e->setResponse($this->normalizeResult($result));

                }



                $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);



                throw $e;

            }
<?php         $httpDownloader->expects(

            [

                ['url' => $repoApiUrl, 'body' => '{"master_branch": "test_master", "owner": {"login": "composer"}, "name": "packagist"}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/contents/composer.json?ref=feature%2F3.2-foo', 'body' => '{"encoding":"base64","content":"'.base64_encode('{"support": {"source": "'.$repoUrl.'" }}').'"}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/commits/feature%2F3.2-foo', 'body' => '{"commit": {"committer":{ "date": "2012-09-10"}}}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/contents/.github/FUNDING.yml', 'body' => '{"encoding": "base64", "content": "'.base64_encode("custom: https://example.com").'"}'],

            ],
<?php                 ['url' => $repoApiUrl, 'body' => '{"master_branch": "test_master", "owner": {"login": "composer"}, "name": "packagist"}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/contents/composer.json?ref=feature%2F3.2-foo', 'body' => '{"encoding":"base64","content":"'.base64_encode('{"support": {"source": "'.$repoUrl.'" }}').'"}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/commits/feature%2F3.2-foo', 'body' => '{"commit": {"committer":{ "date": "2012-09-10"}}}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/contents/.github/FUNDING.yml', 'body' => '{"encoding": "base64", "content": "'.base64_encode("custom: https://example.com").'"}'],

            ],

            true

        );
<?php         $httpDownloader->expects(

            [

                ['url' => $repoApiUrl, 'body' => '{"master_branch": "test_master", "owner": {"login": "composer"}, "name": "packagist", "archived": true}'],

                ['url' => $composerJsonUrl, 'body' => '{"encoding": "base64", "content": "' . base64_encode('{"name": "composer/packagist"}') . '"}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/commits/'.$sha, 'body' => '{"commit": {"committer":{ "date": "2012-09-10"}}}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/contents/.github/FUNDING.yml', 'body' => '{"encoding": "base64", "content": "'.base64_encode("custom: https://example.com").'"}'],

            ],
<?php                 ['url' => $repoApiUrl, 'body' => '{"master_branch": "test_master", "owner": {"login": "composer"}, "name": "packagist", "archived": true}'],

                ['url' => $composerJsonUrl, 'body' => '{"encoding": "base64", "content": "' . base64_encode('{"name": "composer/packagist"}') . '"}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/commits/'.$sha, 'body' => '{"commit": {"committer":{ "date": "2012-09-10"}}}'],

                ['url' => 'https://api.github.com/repos/composer/packagist/contents/.github/FUNDING.yml', 'body' => '{"encoding": "base64", "content": "'.base64_encode("custom: https://example.com").'"}'],

            ],

            true

        );
<?php         $expectedHeaders = array_merge(

            $headers,

            array('Authorization: Basic ' . base64_encode($auth['username'] . ':' . $auth['password']))

        );



        $this->assertSame(
<?php             'proxy' => 'tcp://proxyserver.net:3128',

            'request_fulluri' => true,

            'method' => 'GET',

            'header' => array('User-Agent: foo', "Proxy-Authorization: Basic " . base64_encode('username:p@ssword')),

            'max_redirects' => 20,

            'follow_location' => 1,

        )), $options);
<?php             'proxy' => 'tcp://proxyserver.net:3128',

            'request_fulluri' => false,

            'method' => 'GET',

            'header' => array('User-Agent: foo', "X-Foo: bar", "Proxy-Authorization: Basic " . base64_encode('username:password')),

            'max_redirects' => 20,

            'follow_location' => 1,

        )), $options);
<?php         $this->assertEquals(array('http' => array(

            'proxy' => 'tcp://proxyserver.net:80',

            'method' => 'GET',

            'header' => array('User-Agent: foo', "Proxy-Authorization: Basic " . base64_encode('username:password')),

            'max_redirects' => 20,

            'follow_location' => 1,

        )), $options);