PHP code example of farwish / alcon

1. Go to this page and download the library: Download farwish/alcon library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

farwish / alcon example snippets


Status Code:
$status = \Alcon\Supports\Codes::ACTION_SUC;         // 0
$messag = \Alcon\Supports\Codes::get($status);       // 操作成功
$messag = \Alcon\Supports\Codes::map('ACTION_SUC');  // 操作成功

Helper Class:
\Alcon\Supports\Helper::isInWechat();
\Alcon\Supports\Helper::arrayColumnCombine($array, $column);
\Alcon\Supports\Helper::buildInsertSql($table, $column, array $data);
...

Design Pattern:
\Alcon\Design\Event
\Alcon\Design\Container
\Alcon\Design\Singleton
...

Thirdparty Wechat sdk:
\Alcon\Thirdparty\Wx::get_sns_token($token);
\Alcon\Thirdparty\Wx::get_userinfo($access_token, $openid);
...

Thirdparty Alipay sdk:
------ Create order
$trade = new \Alcon\Thirdparty\Alipay\AlipayTrade();
$trade->setPid('xx');
$trade->setAppid('xx');
$trade->setAlipayPublicKeyPath('xx');
$trade->setAlipayAppPrivateKeyPath('xx');
$trade->setNotifyUrl('http://xx');
$trade->precreateSet('xx', 'xx', 'xx', 'xx');
$trade->precreate();

------ Refund order
$trade = new \Alcon\Thirdparty\Alipay\AlipayTrade();
$trade->setPid('xx');
$trade->setAppid('xx');
$trade->setAlipayPublicKeyPath('xx');
$trade->setAlipayAppPrivateKeyPath('xx');
$trade->refundSet('xx', 'xx');
$trade->refund();

------ Signature can use standalone
self::signature($decoded_query_string);

$ git clone https://github.com/farwish/alcon.git  


Design/   
    |_ Container.php  
    |_ Decorator.php  
    |_ Event.php  
    |_ Singleton.php  
    |_ Strategy.php  

Projects/  
    |_ Alconseek/  

Scripts/   
    |_ model_header.php   
    |_ produce_all_models.php  

Services/  
    |_ ServiceBase.php  

Supports/  
    |_ Codes.php  
    |_ Helper.php  
    |_ StatusTrait.php   

Thirdparty/
    |_ Alipay/
        |_ AlipayHelperTrait.php
        |_ AlipayTrade.php
    |_ Wechat/
        |_ Wx.php
        |_ WxAbstract.php

Traits/  
    |_ ControllerTrait.php   
    |_ JsonRespondTrait.php  
    |_ ModelTrait.php  
    |_ ModelAdvanceTrait.php  
    |_ SentryClientClass.php  
    |_ SentryClientTrait.php