PHP code example of natokpe / php-interface

1. Go to this page and download the library: Download natokpe/php-interface library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

natokpe / php-interface example snippets


use Natokpe\PhpInterface\PhpInterface;

interface->which(); // will print 'cli' if PHP is using CLI to run or 'web' if PHP is run from web

if ( $interface->isCli() ) {
  echo 'cli'; // will print 'cli' if PHP is using CLI to run
}

if ( $interface->isWeb() ) {
  echo 'web'; // will print 'web' if PHP is run from web
}

if ( $interface->isCgi() ) {
  echo 'cgi'; // will print 'cgi' if PHP is using a CGI based interface to run
}

echo PhpInterface::getType(); // will print either 'cli' or 'web' depending on which type of interface PHP is using
bash
$ composer