PHP Classes

File: public/

Recommend this page to a friend!
  Classes of Engin Ypsilon   Curler PHP HTTP Client Library   public/   Download  
File: public/
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Curler PHP HTTP Client Library
Send HTTP requests setup using a fluent interface
Author: By
Last change:
Date: 3 months ago
Size: 2,043 bytes


Class file image Download

Apache2 HTTP Auth

HTTP Auth setup examples for responding Server. See Example Page how to use.

AuthType Basic


AuthType Basic
AuthName "Authentication required"
AuthUserFile /var/www/curler/basic/.htpasswd
Require valid-user

.htpasswd (username:123456)


Create from Terminal, requires apache2-utils

~$ htpasswd -c /var/www/curler/basic/.htpasswd "username"
~$ new password
~$ Re-type new password

Open SSL alternate

printf "username:$(openssl passwd -crypt PASSWORD)\n" >> .htpasswd

AuthType Digest

AuthName "__App Auth Digest__" can be changed to whatever you like, but the Value must be the same in both files, .htaccess & .htpasswd


AuthType Digest
AuthName "App Auth Digest"
AuthDigestProvider file
AuthUserFile /var/www/curler/digest/.htpasswd
Require user "username"

.htpasswd (username:123456)

username:App Auth Digest:bf24c8c2400fc1118862379312380f17

Create from Terminal, requires apache2-utils

~$ htdigest -c /var/www/curler/digest/.htpasswd "App Auth Digest" username
~$ new password
~$ Re-type new password

AuthType Bearer

Many\Http\Curler Example for Shopware 6

 * Get Access Token first
$token = (new Curler)
        'grant_type'    => 'client_credentials',
        'client_id'     => '',
        'client_secret' => '',

$creds = isset($token['access_token']) ? [
    'Authentication' => [$token['token_type'], $token['access_token']],
] : [];

 Set as default_header, so further requests will set the generated header automatically/
Curler::setConfig(['default_header' => $creds]);

/ or individually on each request */
$product = (new Curler)->header($creds)->get('/api/product');

HTTP Auth Types