jorge / cakephp3utilities
CakePHP 3.x 工具
    0.1.1
    2016-02-08 15:28 UTC
Requires
- php: >=5.4.16
- cakephp/cakephp: ~3.0
- facebook/php-sdk-v4: ^5.1
- pagseguro/php: 2.*
This package is auto-updated.
Last update: 2024-08-27 03:28:24 UTC
README
#CakePHP 3.x 工具
- Gerencianet
- Cpanel XmlApi
安装
Composer
require: "jorge/cakephp3utilities": "dev-master"
配置
'CPanel' => [
    'default' => [
        'domain' => 'tryggu.com.br',
        'username' => 'tryggu',
        'password' => 't4r5zjj',
        'port' => '2082',
        'debug' => true
    ]
],
'Gerencianet' => [
    'token' => 'ADFS7F834KDJULJORGE5993485H5KK3GG2234678',
],
Gerencianet 示例
$this->loadComponent('CakePHP3Utilities.Gerencianet');
$this->Gerencianet->item('Produto 1', 1, '1.200,00');
$this->Gerencianet->vencimento('2015-10-30');
$this->Gerencianet->retorno(time(), 'http://www.suaurl.com.br', 'http://www.suaurl.com.br');
$this->Gerencianet->cliente(
    'Maria da Silva',
    'email@teste.com.br',
    '(11) 98549-8123',
    '1980-11-24',
    '120.445.115-00'
);
$this->Gerencianet->endereco(
    '02462-020',
    'Rua Manoel Almeida Santos',
    '524',
    null,
    'V. Paulista',
    'Sao Paulo',
    'SP'
);
$this->Gerencianet->marketplace('3VTV93SFBKHL');
$this->Gerencianet->periodicidade(1);
$return = $this->Gerencianet->enviar();
Cpanel XmlApi 示例
$this->loadComponent('CakePHP3Utilities.CPanel');
if ($this->CPanel->domainCreatedSub('subdomain', 'yourdomain.com.br')) {
    # code...
} else {
    $this->Flash->error(__($this->CPanel->error));
}
巴西数据验证示例
附加到模型
<?php public function validationDefault(Validator $validator) { $validator ->provider('custom', new \JCustomCakephp3\Validation\CustomProvider) ->add('birth', 'valid', ['rule' => 'dateBR', 'provider' => 'custom']) ->requirePresence('birth', 'create') ->notEmpty('birth'); }
规则
- dateBR
- datetimeBR
- cnpj
- cpf
- cep
- 电话
- 手机