sgl/flts-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sgl/flts-bundle

Composer 安装命令:

composer require sgl/flts-bundle

包简介

Freelancer Timesheets and Billing Symfony2 Bundle

README 文档

README

SGLFLTSBundle is a timesheet and billing application Symfony2 bundle mainly for freelancers. It is a port of my sf1.0 timesheet application I used for 4 years.

Demo

flts.centdix.com

Version 1

Build status

branch phpver status
master 5.5 Build Status

Objects

  • User - The user (freelancer) using FLTS app (FOSUserBundle user)
  • Client - Direct client or agency who's dealing with client
  • Project - e.g. Some quick neat app
  • Project Part - e.g. Dashboard modifications
  • Task - e.g. Backend programming, Team Coordination, Traveling, etc.
  • Work - e.g. Work on the user dashboard (revision 110)
  • Bill - Invoice with checked works to bill client

Installation

  1. Install FLTS using composer

        # composer.json  
        "require": {
            "php": ">=5.5",
            "sgl/flts-bundle": "dev-master"  
        }  
  2. Check FLTS requirements documentation
    (using composer)

    1.1 FOSUserBundle
    1.2 GenemuFormBundle
    1.3 KnpSnappyBundle
    1.4 JMSSecurityExtraBundle
    1.5 AsseticBundle
    1.6 Hashids

  3. Enable FLTS and requirements bundles

        
        # AppKernel.php
        
        $bundles = array(
            # [...]
            
            new JMS\AopBundle\JMSAopBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new Genemu\Bundle\FormBundle\GenemuFormBundle(),
            new Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
            new SGL\FLTSBundle\SGLFLTSBundle(),
  4. Add required parameters (parameters.yml.dist), config (config.yml) and routing (routing.yml)
    See examples at bottom

  5. Install third-party helpers
    Hint : you can extend FLTS bundle in your project and install those libraries inside.

    5.1 TinyMCE

  6. Edit firewall and security (security.yml)
    See security.yml example at bottom

  7. Update your database

        app/console doctrine:schema:update --dump-sql
        app/console doctrine:schema:update --force
  8. Dump assets

        app/console assets:install web --symlink
        app/console --env=prod assetic:dump
        app/console --env=dev assetic:dump
  9. Add an admin user
    Browse "http://the-hostname/register"
    Check role 'ROLE_ADMIN'

  10. After creating your first admin user, remove anonymous registration access
    (FLTS has an User CRUD) You can also remove registration routes inside routing.yml

        # security.yml
        access_control: {
            - { path: ^/register, role: ROLE_ADMIN }
        }
  11. Browse "http://the-hostname/timesheet" and create new clients, your frequent tasks, etc.

Configurations Examples

Parameters

    # app/config/parameters.yml.dist
    
    # SGL FLTS params
    sgl_flts.business_name:                   "Symfony dev4fun"
    sgl_flts.business_logo_src:               ~ # Ex.: "/bundles/myFltsExtended/images/logos/sgl.png"
    sgl_flts.business_logo_width:             ~
    sgl_flts.business_invoice_logo_src:       %sgl_flts.business_logo_src%
    sgl_flts.business_invoice_logo_width:     %sgl_flts.business_logo_width%
    sgl_flts.business_address:                "30, rue de la Visitation\nSaint-Charles-Borromée, Québec\nJ6E 4M8"
    sgl_flts.business_phone:                  "457 059-1113"

    sgl_flts.tax_class:                       SGL\FLTSBundle\Util\Tax\CanadaTax
    sgl_flts.tax_gst:   # Goods and Services Tax
        - 5.00
    sgl_flts.tax_pst:   # Quebec Tax rates (year : rate)
        2008: 7.875         # Earlier years will get the first year value
        2009: 7.875
        2010: 7.875
        2011: 8.925
        2012: 9.975         # Later years will get the last year value
    sgl_flts.tax_hst:   # Harmonized Sales Tax
        - null

    sgl_flts.bill_gst_registration_number:    99999 9999 RT0001
    sgl_flts.bill_pst_registration_number:    9999999999 TQ0001
    sgl_flts.bill_hst_registration_number:    null

    sgl_flts.bill_latest_period:              P0Y4M  # In years-months, see DateInterval __construct parameter
    sgl_flts.bill_taxable:                    true   # Bill taxable by default

    sgl_flts.recent_parts_limit:              10     # Maximum element in recent parts list

    # knp snappy params
    knp_snappy.pdf_binary:                    /usr/local/bin/wkhtmltopdf  # which wkhtmltopdf
    knp_snappy.pdf_option_lowquality:         false
    knp_snappy.pdf_option_image-quality:      100
    knp_snappy.pdf_option_no-pdf-compression: false
    knp_snappy.pdf_option_grayscale:          true
    knp_snappy.temporary_folder:              %kernel.cache_dir%
    knp_snappy.disable-smart-shrinking:       true
    
    fos_user.from_email.address:              test@test.com
    fos_user.from_email.sender_name:          Admin

Config

    # app/config/config.yml  
    

    $ Assetic
    assetic:
        debug:          '%kernel.debug%'
        use_controller: '%kernel.debug%'
        filters:
            cssrewrite: ~
    
    # Twig global variables
    twig:
        debug:            %kernel.debug%
        strict_variables: %kernel.debug%
        globals:
            business_name:       %sgl_flts.business_name%
            business_logo_src:   %sgl_flts.business_logo_src%
            business_logo_width: %sgl_flts.business_logo_width%
    
    # FOS conf
    fos_user:
        db_driver: orm # other valid values are 'mongodb', 'couchdb'
        firewall_name: main
        user_class: SGL\FLTSBundle\Entity\User
    
        registration:
            form:
                type: SGL\FLTSBundle\Form\RegistrationFormType
        profile:
            form:
                type: SGL\FLTSBundle\Form\UserType
        from_email:
            address: %fos_user.from_email.address%
            sender_name: %fos_user.from_email.sender_name%
    
    # knp snappy conf
    knp_snappy:
        pdf:
            enabled:    true
            binary:     %knp_snappy.pdf_binary%
            options:
                lowquality: %knp_snappy.pdf_option_lowquality%
                image-quality: %knp_snappy.pdf_option_image-quality%
                no-pdf-compression: %knp_snappy.pdf_option_no-pdf-compression%
                grayscale: %knp_snappy.pdf_option_grayscale%
                disable-smart-shrinking: %knp_snappy.disable-smart-shrinking%
        image:
            enabled:    false
    
    # genemu form conf
    genemu_form:
        date: ~
        image: ~
        tinymce:
            enabled: true
            theme:   advanced
            script_url: /bundles/myFltsExtended/js/tiny_mce/tiny_mce.js
            configs:
                content_css : /bundles/sglflts/css/invoice.css
                plugins : table
                theme_advanced_buttons1 : bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink
                theme_advanced_buttons2 : tablecontrols,separator
                theme_advanced_buttons3 : ~
                theme_advanced_toolbar_location : top
                theme_advanced_toolbar_align : center
                extended_valid_elements : a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]

Routing

    # app/config/routing.yml
    
    sgl_flts:
        resource: "@SGLFLTSBundle/Resources/config/routing/flts.yml"
        prefix:   /timesheet
    
    fos_user_security:
        resource: "@FOSUserBundle/Resources/config/routing/security.xml"
    
    fos_user_profile:
        resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
        prefix: /profile
    
    fos_user_resetting:
        resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
        prefix: /resetting
    
    fos_user_change_password:
        resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
        prefix: /profile
    
    fos_user_registration:
        resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
        prefix: /register
    
    genemu_image:
        resource: "@GenemuFormBundle/Resources/config/routing/image.xml"

Security

    # app/config/security.yml

    jms_security_extra:
        secure_all_services: false
        expressions: true
    
    security:
        encoders:
            FOS\UserBundle\Model\UserInterface: sha512
    
        providers:
            fos_userbundle:
                id: fos_user.user_provider.username
    
        firewalls:
            main:
                pattern: ^/
                form_login:
                    provider: fos_userbundle    # See providers
                    csrf_provider: security.csrf.token_manager
                    default_target_path: /timesheet/dashboard
    
                logout:       true
                anonymous:    true
            dev:
                pattern:  ^/(_(profiler|wdt)|css|images|js)/
                security: false
    
            login:
                pattern:  ^/login$
                security: false
    
                #anonymous: ~
                #http_basic:
                #    realm: "Secured Demo Area"
    
        role_hierarchy:
            ROLE_USER:        ~
            ROLE_BILL:        ROLE_USER   # Bill user has user roles
            ROLE_ADMIN:       ROLE_BILL   # Admin user has bill and user roles
            ROLE_SUPER_ADMIN: ROLE_ADMIN  # Super admin has admin, bill and user roles
    
        access_control:
            - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    
            - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } # Set to ROLE_ADMIN after 1st user creation
            - { path: ^/profile, role: ROLE_ADMIN }
    
            - { path: ^/timesheet/invoices, roles: IS_AUTHENTICATED_ANONYMOUSLY }  # Used by wkhtmltopdf locally
            - { path: ^/timesheet/clients, role: ROLE_ADMIN }
            - { path: ^/timesheet/projects, role: ROLE_ADMIN }
            - { path: ^/timesheet/bills, role: ROLE_BILL }
            - { path: ^/timesheet/tasks/frequent, role: ROLE_ADMIN }
            - { path: ^/timesheet/users, role: ROLE_ADMIN }
            - { path: ^/timesheet/dashboard, role: ROLE_USER }
    
            - { path: ^/timesheet, role: ROLE_USER }
    
            - { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY }

Coming soon

TODO

  • Multiuser has not been tested
  • Theme layout/CSS
  • svn/git integration (revision/hash)
  • Tests

sgl/flts-bundle 适用场景与选型建议

sgl/flts-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 136 次下载、GitHub Stars 达 12, 最近一次更新时间为 2013 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「invoice」 「timesheet」 「project management」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 sgl/flts-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sgl/flts-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 sgl/flts-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 136
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 30
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-02-12