Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.
/ slib Public archive

A collection of useful functions to aid developing.

License

Notifications You must be signed in to change notification settings

b01/slib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

CircleCI

This is a library with some tools to aid in performing common task.

Examples:

How to use the HttpClient object to make an HTTP Request

<?php

use \Kshabazz\Slib\HttpClient;

// Initialize a new HTTP client object.
$httpClient = new HttpClient();
$url = 'http://www.example.com';

// Set headers
// Please note that the same header can be set multiple times, just like in the HTTP RFC.
$httpClient->setHeaders([
    'Content-Type: application/json; charset=utf-8',
    'Custom-Header: custom value',
]);

// Make a request and check the response.
$httpClient->send( $url );
$responseCode = $http->responseCode();
if ( $responseCode === 200 ) {
    echo $httpClient->responseBody();

} else { // DEBUG
    // Show what was sent in the last request.
    var_dump( $httpClient->lastRequest() );
    
    // Show the response headers.
    var_dump( $httpClient->responseHeaders() );
}
?>

Functions

<?php
echo \Kshabazz\Slib\camelCase( 'test-me' );
// Output:
TestMe

echo \Kshabazz\Slib\camelCase( 'test-me', TRUE );
// Output:
testMe
?>

About

A collection of useful functions to aid developing.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages