Recommend this page to a friend!
  Classes of Lars Moelleken  >  PHP httpful Request  >  >  Download  
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP httpful Request
Send and process HTTP requests using handler class
Author: By
Last change:
Date: 1 year ago
Size: 1,380 bytes


Class file image Download
#!/usr/bin/env php

 * Build the whole library into a single file
 * as an easy drop in solution as opposed to
 * relying on autoloader.  Sometimes we just
 * want to hack with an API as a one off thing.
 * Httpful should make this easy.

 * @param      $condition
 * @param null $msg
function exit_unless($condition, $msg = null)
  if ($condition) {
  echo "[FAIL]\n$msg\n";

// Create the Httpful Phar
echo "Building Phar... ";
$base_dir = __DIR__;
$source_dir = $base_dir . '/src/Httpful/';
$phar_path = $base_dir . '/downloads/httpful.phar';
$phar = new Phar($phar_path, 0, 'httpful.phar');
$stub = <<<HEREDOC
    // Phar Stub File


try {
} catch (Exception $e) {
  $phar = false;

exit_unless($phar, "Unable to create a phar.  Make certain you have phar.readonly=0 set in your ini file.");
echo "[ OK ]\n";

// Add it to git!
//echo "Adding httpful.phar to the repo... ";
//$return_code = 0;
//passthru("git add $phar_path", $return_code);
//exit_unless($return_code === 0, "Unable to add download files to git.");
//echo "[ OK ]\n";
echo "\nBuild completed successfully.\n\n";
For more information send a message to info at phpclasses dot org.