/communia

Library with common features in PHP

Primary LanguageHackGNU General Public License v2.0GPL-2.0

Communia

DON'T USE THIS - NOT READ YET!

A common library i created from pi-framework and i reused in others projects.

A set of tools and common implementations/interfaces i use as well.

Http Request

HttpRequest is a utility object to execute HTTP requests supporting features like headers, cookies and authentication.

Responses are returned as HttpMessage

Container

My implementation for a IOC is horrible and temporary. I've wrote a custom one because i want direct implementation with cache mechanism and others providers like AbstractMetadataFactory and AbstractHydratorFactory.

Cache Provider

The Cache Providers implements the ICacheProvider interface:

public function get($key = null) : ?mixed; 
public function set($key, $value) : void;
public function getArray(string $key) : ?array;
public function push(string $key, string $value) : void;
public function pushObject(string $key, mixed $obj) : void;
public function getAs(string $key, string $className) : ?mixed;
public function getMap(string $key) : ?Map<string,string>;
public function pushMap(string $key, string $mapKey, string $mapValue) : void;
public function contains($key) : bool;

Available Cache Providers

  • APC
  • Redis (not finished yet)
  • Memcached (not testes yet)

Log

The Log Providers implements the ILogFactory interface. Each factory is responsible for returning a ILog instance (available for specific types) implementing:

public function debug(string $message);
public function error($message);
public function fatal($message);
public function info($message);
public function warn($message);