2017 © Pedro Peláez
 

library wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.4+ development.

image

wei/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.4+ development.

  • Wednesday, June 6, 2018
  • by twin
  • Repository
  • 7 Watchers
  • 40 Stars
  • 6,279 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 15 Forks
  • 3 Open issues
  • 29 Versions
  • 4 % Grown

The README.md

Wei

Build Status Coverage Status Latest Stable Version License, (*1)

Wei is a micro-framework provided powerful but simple APIs for faster and easier PHP development., (*2)

Getting started

Start using Wei in 3 steps, it's easier than any frameworks you've seen before!, (*3)

// 1. Include the wei container class
require 'path/to/wei/lib/Wei.php';

// 2. Create the default wei container instance
$wei = wei([
    // Options for wei container
    'wei' => [
        'debug' => true,
        // Other options ...
    ],
    // Options for database
    'db' => [
        'driver'    => 'mysql',
        'host'      => 'localhost',
        'dbname'    => 'wei',
        'charset'   => 'utf8',
        'user'      => 'root',
        'password'  => 'xxxxxx',
    ],
    // More options ...
]);

// 3. Using "db" object to execute SQL query
$result = $wei->db->fetch("SELECT 1 + 2");

Installation

Composer

Run the following command to install, (*4)

composer require wei/wei

Download source code

Resources

API Overview

Cache

// Available cache objects
$wei->cache;
$wei->apcu;
$wei->arrayCache;
$wei->dbCache;
$wei->fileCache;
$wei->memcache;
$wei->memcached;
$wei->mongoCache;
$wei->redis;
$wei->nullCache;

$cache = $wei->memcached;

// Cache APIs
$cache->get('key');
$cache->set('key', 'value', 60);
$cache->delete('key');
$cache->has('key');
$cache->add('key', 'value');
$cache->replace('key', 'value');
$cache->incr('key', 1);
$cache->decr('key', 1);
$cache->getMultiple(array('key', 'key2'));
$cache->setMultiple(array('key' => 'value', 'key2' => 'value2'));
$cache->clear();

// ...

Database

$db = $wei->db;

// Basic CRUD and Active Recrod support
$db->query();
$db->insert();
$db->update();
$db->delete();
$db->select();
$db->selectAll();
$db->fetch();
$db->fetchAll();
$db->fetchColumn();
$db->find();
$db->findOne();
$db->findAll();
$db->execute();

// Using query builder to build SQL
$record = $db('table');

$record
    ->select()
    ->addSelect()
    ->update()
    ->delete()
    ->from()
    ->where()
    ->andWhere()
    ->orWhere()
    ->groupBy()
    ->addGroupBy()
    ->having()
    ->andHaving()
    ->orHaving()
    ->orderBy()
    ->addOrderBy()
    ->offset()
    ->limit()
    ->page()
    ->indexBy();

$record->find();
$record->findAll();
$record->fetch();
$record->fetchAll();
$record->fetchColumn();
$record->count();
$record->execute();
$record->getSql();

// ...

Validator

// Available validator objects

// Data type and composition
$wei->isAlnum($input);
$wei->isAlpha($input);
$wei->isBlank($input);
$wei->isDecimal($input);
$wei->isDigit($input);
$wei->isDivisibleBy($input);
$wei->isDoubleByte($input);
$wei->isEmpty($input);
$wei->isEndsWith($input);
$wei->isIn($input);
$wei->isLowercase($input);
$wei->isNull($input);
$wei->isNumber($input);
$wei->isRegex($input);
$wei->isRequired($input);
$wei->isStartsWith($input);
$wei->isType($input);
$wei->isUppercase($input);

// Length
$wei->isLength($input);
$wei->isCharLength($input);
$wei->isMaxLength($input);
$wei->isMinLength($input);

// Comparison
$wei->isEqualTo($input);
$wei->isIdenticalTo($input);
$wei->isGreaterThan($input);
$wei->isGreaterThanOrEqual($input);
$wei->isLessThan($input);
$wei->isLessThanOrEqual($input);
$wei->isBetween($input);

// Date and time
$wei->isDate($input);
$wei->isDateTime($input);
$wei->isTime($input);

// File and directory
$wei->isDir($input);
$wei->isExists($input);
$wei->isFile($input);
$wei->isImage($input);

// Network
$wei->isEmail($input);
$wei->isIp($input);
$wei->isTld($input);
$wei->isUrl($input);
$wei->isUuid($input);

// Region: All
$wei->isCreditCard($input);

// Region: Chinese
$wei->isChinese($input);
$wei->isIdCardCn($input);
$wei->isIdCardHk($input);
$wei->isIdCardMo($input);
$wei->isIdCardTw($input);
$wei->isPhoneCn($input);
$wei->isPostcodeCn($input);
$wei->isQQ($input);
$wei->isMobileCn($input);

// Group
$wei->isAllOf($input);
$wei->isNoneOf($input);
$wei->isOneOf($input);
$wei->isSomeOf($input);

// Others
$wei->isAll($input);
$wei->isCallback($input);
$wei->isColor($input);

// Validate and get error message
if (!$wei->isDigit('abc')) {
    print_r($wei->isDigit->getMessages());
}

// ...

More

$wei->request;
$wei->cookie;
$wei->session;
$wei->ua;
$wei->upload;
$wei->response;
$wei->e;
$wei->logger;
$wei->call;
$wei->env;
$wei->error;

// ...

Testing

To run the tests:, (*5)

$ phpunit

License

Wei is an open-source project released MIT license. See the LICENSE file for details., (*6)

The Versions

06/06 2018

dev-master

9999999-dev https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.4+ development.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

database framework cache validator

20/03 2017

v0.9.23

0.9.23.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

22/11 2016

v0.9.22

0.9.22.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

04/08 2016

v0.9.21

0.9.21.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

18/06 2015

v0.9.20

0.9.20.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

25/05 2015

v0.9.19

0.9.19.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

27/03 2015

v0.9.17

0.9.17.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

29/01 2015

0.9.16

0.9.16.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

07/12 2014

0.9.15

0.9.15.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

24/03 2014

0.9.14

0.9.14.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

16/03 2014

0.9.13

0.9.13.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

13/02 2014

0.9.12

0.9.12.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

05/02 2014

0.9.11

0.9.11.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

27/01 2014

0.9.10

0.9.10.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

database framework cache validator

08/01 2014

0.9.9

0.9.9.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

database framework cache validator

05/01 2014

0.9.9-RC1

0.9.9.0-RC1 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

database framework cache validator

10/12 2013

0.9.8

0.9.8.0 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

06/12 2013

0.9.8-RC1

0.9.8.0-RC1 https://github.com/twinh/wei

A micro-framework provided powerful and simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

31/10 2013

0.9.7

0.9.7.0 https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

28/10 2013

0.9.7-RC1

0.9.7.0-RC1 https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

09/10 2013

0.9.6

0.9.6.0 https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

05/10 2013

0.9.6-RC1

0.9.6.0-RC1 https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

08/09 2013

0.9.5

0.9.5.0 https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

04/09 2013

0.9.5-RC1

0.9.5.0-RC1 https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

28/08 2013

dev-feature/async-widget

dev-feature/async-widget https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

07/08 2013

0.9.4

0.9.4.0 https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

04/07 2013

0.9.3

0.9.3.0 https://github.com/twinh/widget

A micro-framework provided powerful but simple APIs for faster and easier PHP 5.3+ development.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database framework cache validator

15/04 2013

0.9.2-beta

0.9.2.0-beta https://github.com/twinh/widget

A new way to write PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

library