2017 © Pedro Peláez
 

library wechat

image

yfwz100/wechat

  • Friday, April 6, 2018
  • by yfwz100
  • Repository
  • 3 Watchers
  • 11 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Wechat.php

Wechat.php is an effort to create an elegant utility to interact with Server of Wechat Media Platform, in PHP. Wechat.php is designed to work well with modern PHP environment, including namespaces and composer. The API is strongly influenced by a fluent package written in Node.js, written in modern PHP syntax. We hope this collection of code could benefit anyone who works with an account of Wechat Media Platform., (*1)

The design of the library strictly follows the design of the Wechat Web API and provides functions/classes to facilitate your development. -- We do the painful things for you!, (*2)

Installation

Though 'Wehcat.php' is designed to work with composer, the library is not yet uploaded and is under construction. Please add repository to your composer.json:, (*3)

"repositories": [
    {
        "type": "vcs",
        "url": "https://git.oschina.net/zhi/wechat.php.git"
    }
]

Then add dependency:, (*4)

"require": {
    "yfwz100/wechat": "dev-master"
}

Example

<?php include_once './vendor/autoload.php'; // autoload by composer.

use yfwz100\wechat as wechat;

// Do the verification and delegate requests to proper handlers.
wechat\Init::withToken('...YOUR TOKEN...');

$router = wechat\Router::get();

// Subscription event.
$router->event->on('subscribe', function () {
    // use `echo` to output everything you want just like plain PHP.
    // wechat\Reply class will generate the necessary XML for you.
    echo wechat\Reply::text("Welcome subscribing~");
});

// click action is subsection of events.
$router->event->click->match('clicked', function ($matches) {
    echo wechat\Reply::text("You've clicked 'clicked'!");
});

// Keyword reply.
$router->text->match('hello', function ($matches) {
    echo wechat\Reply::text("Hello, world!");
});

Author

Zhi - yfwz100@yeah.net, (*5)

License

MIT., (*6)

The Versions

06/04 2018

v0.1.0

0.1.0.0

  Sources   Download

16/06 2016

dev-master

9999999-dev

An elegant wechat framework for PHP 5.5 .

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Zhi

16/06 2016

v0.3.1

0.3.1.0

An elegant wechat framework for PHP 5.5 .

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Zhi

06/06 2016

v0.3.0

0.3.0.0

An elegant wechat framework for PHP 5.5 .

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Zhi

23/10 2015

v0.2.0

0.2.0.0

An elegant wechat framework for PHP 5.5 .

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Zhi