ais/semesterbundle

包含Semester的包

安装: 10

依赖: 0

建议者: 0

安全性: 0

星级: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

dev-master / 0.0.1.x-dev 2016-01-11 05:52 UTC

This package is not auto-updated.

Last update: 2024-09-24 19:14:02 UTC


README

AIS的semester Bundle。我在工具包中使用Symfony 2.7.4。如果您想安装Symfony,请访问以下链接

Symfony 2.7

使用方法

我假设您已经在开发环境中安装了composer。如果没有,请访问此链接

Composer入门

在您的根composer.json文件中的require标签内添加以下内容

{
    "require": {
      "ais/semesterbundle" : "dev-master"
    },
}

运行composer update,并等待composer update完成。

php composer.phar update

将包注册到您的AppKernel.php中

composer更新完成后。如果您之前还没有安装NelmioApiDocBundle,您还需要注册它。

因为这个包需要NelmioApiDocBundle来查看API文档。我还使用了JMS Serializer和FOSRestBundle。

<?php
// app/AppKernel.php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
        ...
            new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
            new FOS\RestBundle\FOSRestBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),
            new Ais\SemesterBundle\AisSemesterBundle(),
        );
        ...

        return $bundles;
    }
}

将路由导入到您的app/config/routing.yml中

  ais_semesters:
    type: rest
    prefix: /api
    resource: "@AisSemesterBundle/Resources/config/routes.yml"
  
  NelmioApiDocBundle:
    resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
    prefix:   /api/doc

查看内部结构

现在您可以通过访问您的url dev来查看可用的API

ex: https:///web/app_dev.php/api/doc

发现一个错误?只需向我提出PR。如果您发现一些错误,请通过电子邮件帮助我修复它,发送到vizzlearn@gmail.com