Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
URL-encodes string
<?php urlencode(string $string): string
<?php         $url = $this->listUrl;

        if (is_string($packageFilter) && $packageFilter !== '') {

            $url .= '?filter='.urlencode($packageFilter);

            $result = $this->httpDownloader->get($url, $this->options)->decodeJson();



            return $result['packageNames'];
<?php         if ($this->hasProviders() || $this->lazyProvidersUrl) {


            if (Preg::isMatch('{^\^(?P<query>(?P<vendor>[a-z0-9_.-]+)/[a-z0-9_.-]*)\*?$}i', $query, $match) && $this->listUrl !== null) {

                $url = $this->listUrl . '?vendor='.urlencode($match['vendor']).'&filter='.urlencode($match['query'].'*');

                $result = $this->httpDownloader->get($url, $this->options)->decodeJson();



                $results = array();
<?php             return $this->gitDriver->getFileContent($file, $identifier);

        }



        $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);

        $resource = $this->getContents($resource)->decodeJson();

        if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {

            throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
<?php             return $this->gitDriver->getChangeDate($identifier);

        }



        $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);

        $commit = $this->getContents($resource)->decodeJson();



        return new \DateTime($commit['commit']['committer']['date']);
<?php         $port = '5443';

        $namespace = 'mygroup/myproject';

        $url = sprintf('https://%1$s:%2$s/%3$s', $domain, $port, $namespace);

        $apiUrl = sprintf('https://%1$s:%2$s/api/v4/projects/%3$s', $domain, $port, urlencode($namespace));