Skip to content

resourcemode/PHP-standalone-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-standalone-scripts

All PHP standalone scripts

Class

  • API Class
  • Call REST Api using php cURL Extension
  • CookieTraits
  • Use to check whether browser cookie is enabled. You may use for storing, getting, destroying the cookies by name

Sample Usage

API Class

Im using http://www.binlist.net/ web service (REST API) to check the bank identification number.

$format = 'json'; //format can be (json, xml etc.) <br />
$bin    = 429503; //checking (Bank Identification Number)<br />
$apiUrl = "http://www.binlist.net/{$format}/{$bin}";<br />
$api = new ApiCaller(); //instantiate API Class<br />
$checkBin = $api->call('GET', $apiUrl); //call API call method<br />
var_dump($checkBin); //check output

Cookie Class

Here's the sample on how to use the CookieTraits in your controller.

/**
 * Class SampleController
 */
class SampleController extends AbstractController
{
    use CookieTraits;

    /**
     * Get the index page
     *
     * @param Request $request
     */
    public function index(Request $request)
    {
        if (false === $this->isCookieEnabled()) {
            // do necessary action if cookie is not enabled
        }
        
        // proceed to the next step
    }
    
}

Test

./vendor/bin/phpunit --bootstrap vendor/autoload.php

About

Simple standalone PHP Classes/Traits

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages