paggy/boleto-bundle

Paggy BoletoBundle

安装: 77

依赖: 0

建议者: 0

安全性: 0

星标: 2

关注者: 2

分支: 2

公开问题: 0

类型:symfony-bundle

v1.0 2013-08-16 16:22 UTC

This package is not auto-updated.

Last update: 2024-09-23 14:07:56 UTC


README

欢迎使用PaggyBoletoBundle - 制作工资单再次变得有趣!

基本文档

安装

步骤 1) 使用composer获取包

在composer.json中添加(见 https://getcomposer.org.cn/

"require" :  {
    // ...
    "paggy/boleto-bundle": "dev-master",
}

并运行

composer update paggy/boleto-bundle

步骤 2) 注册包

要开始使用该包,请在Kernel中注册它

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Paggy\BoletoBundle\PaggyBoletoBundle,
    );
    // ...
}

并运行控制台命令以安装其资源

 php app/console assets:install

步骤 3) 配置包

此步骤不是必需的,但如果跳过此步骤,可能需要在PHP代码中提供相同的信息。

# app/config/config.yml
# PaggyBoleto Configuration:
paggy_boleto:
    cedants:
        mybusiness:
            name: My Enterprise Inc.
            cnpj: 01.234.567/0001-89
            bank: CEF
            branch: 1234
            code: 345678
    paths:
        default:
            favicon: bundles/mysite/images/favicon.ico
    payslips:
        cef:
            wallet: RG
            instructions: |
                - Sr. Caixa, após o vencimento, cobrar multa de 2%% e juros de mora de 0,33%% ao dia
                - Receber até 30 dias após o vencimento

创建您的第一张工资单!

要创建工资单,获取 paggy_boleto.view 服务并调用其 render 函数,将工资单数据作为数组参数传递。

示例可能如下所示

<?php
// src/Acme/DemoBundle/Controller/Payment.php
namespace Acme\DemoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class PaymentController extends Controller
{
    public function payslipAction()
    {
        $data = array(
            'payer_name'              => 'John Doe',
            'payer_address_line1'     => 'Success Street, 108',
            'payer_address_line2'     => 'Success City, SS',
            'payslip_value'           => number_format('180', 2, ',', ''),
            'payslip_due_date'        => date('d/m/Y'),
            'payslip_document_number' => '1567',
            'payslip_description'     => 'Premium Hosting',
        );
        return new Response($this->get('paggy_boleto.view')->render($data));
    }
}