malwarebytes/altamirabundle

使用Altamira库的Pretty JS图表,适用于Symfony

dev-master 2013-01-24 18:52 UTC

This package is not auto-updated.

Last update: 2021-10-01 22:50:41 UTC


README

一个用于JavaScript图表的PHP抽象库,作为Symfony 2服务包构建。

以下库通过git子模块链接到此包

  • Jquery
  • Flot
  • jqPlot

您可以通过检查git子模块中想要使用的版本来跳转到任何版本。

入门指南

  • 先决条件:您需要一个已安装并配置好的Symfony2框架。

重要 - 请按顺序执行说明,否则JS库依赖项将无法正确构建

  1. 将AltamiraBundle ScriptHandler添加到composer.json文件中scripts部分的post-install-cmdpost-update-cmd部分。

        "scripts": {
            "post-install-cmd": [
                "Malwarebytes\\AltamiraBundle\\ScriptHandler::installJSDependencies",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    
            ],
            "post-update-cmd": [
                "Malwarebytes\\AltamiraBundle\\ScriptHandler::installJSDependencies",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
            ]
        }

    注意 在安装Assets之前,您必须先添加我们的包,否则您将需要手动重新运行安装资产。

  2. 现在通过composer安装altamira-bundle。

    从您的main symfony2目录运行

    $ composer require malwarebytes/altamirabundle:dev-master
  3. 在symfony中启用包

    <?php
    // app/AppKernel.php
    
    public function registerBundles()
    {
         $bundlles = array (
             // ...
             new Malwarebytes\AltamiraBundle\MalwarebytesAltamiraBundle(),
         );
    }
  4. 如果您想查看示例代码,请启用示例控制器

    # app/config/routing.yml
    
    altamira_example:
        resource: "@MalwarebytesAltamiraBundle/Resources/config/routing.yml"
        prefix:   /chart_demo

故障排除

如果您在查看示例时发现缺少javascript文件,JS依赖项可能没有正确获取。请检查Resources/public/js/文件夹中的文件夹是否不为空。

如果libs文件夹中存在代码,则资产可能未能安装到web文件夹中。运行以下命令以重新生成资产

$ app/console assets:install

开发

有关如何使用代码的示例,请参考示例控制器。