2017 © Pedro Peláez
 

library php-global-abstraction

Wrapper around features of PHP which affect global scope

image

adamquaile/php-global-abstraction

Wrapper around features of PHP which affect global scope

  • Friday, February 6, 2015
  • by adamquaile
  • Repository
  • 1 Watchers
  • 0 Stars
  • 67 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

Global scope abstraction for PHP

This library provides object-oriented wrappers around some of the features of PHP affecting global scope., (*1)

The currently implemented features are:, (*2)

  • Constants
  • Functions
  • Echo / Print

Global state is evil. Avoid it wherever possible. Do not think this library makes it okay., (*3)

This library has two main use cases:, (*4)

  • when you're working in an environment where it's unavoidable, and you still want code you write as testable as possible
  • while you're refactoring your code to get out of this mess

Usage

Install it with composer, adamquaile/php-global-abstraction., (*5)

Constants, (*6)

<?php

$constants = new \AdamQuaile\PhpGlobal\Constants\ConstantWrapper();

$constants->set('key', 'value');
$constants->get('key');
$constants->isDefined('key');

Functions, (*7)

<?php

$functions = new \AdamQuaile\PhpGlobal\Functions\FunctionWrapper(
    new FunctionCreator(),
    new FunctionInvoker()
);

# Create function with a specified name

$functions->create($callable, 'func_in_global_scope');
\func_in_global_scope($arguments);


# Create function and return its automatically generated name

$functionName = $functions->create($callable);
$$functionName($arguments);

# Call a function existing in global scope
$functions->invoke('strlen', 'hello world');

Echo / Print, (*8)

<?php

$output = new \AdamQuaile\PhpGlobal\Output\EchoWrapper();

$output->output('Hello ', $world);

The Versions

06/02 2015

dev-master

9999999-dev

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

06/02 2015

v1.2.1

1.2.1.0

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

06/02 2015

dev-feature/function-not-found

dev-feature/function-not-found

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

04/02 2015

v2.0.0

2.0.0.0

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

04/02 2015

dev-feature/split-function-invoker

dev-feature/split-function-invoker

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

04/02 2015

v1.3.0

1.3.0.0

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

03/02 2015

dev-feature/echo

dev-feature/echo

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

01/02 2015

v1.2.0

1.2.0.0

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

01/02 2015

dev-feature/functions-invoke

dev-feature/functions-invoke

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

01/02 2015

v1.1.0

1.1.0.0

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

01/02 2015

dev-feature/functions

dev-feature/functions

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

31/01 2015

v1.0.0

1.0.0.0

Wrapper around features of PHP which affect global scope

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires