ais/mahasiswaprofilebundle

一个包含 MahasiswaProfile 的打包工具

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

This package is not auto-updated.

Last update: 2024-09-24 19:34:18 UTC


README

mahasiswaprofile 包用于 AIS。我在我的环境中使用了 Symfony 2.7.4。如果你想安装 Symfony,请遵循以下链接

Symfony 2.7

使用方法

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

通过 Composer 开始

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

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

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

php composer.phar update

在 AppKernel.php 中注册该包

composer update 完成。如果你之前还没有安装 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\MahasiswaProfileBundle\AisMahasiswaProfileBundle(),
        );
        ...

        return $bundles;
    }
}

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

  ais_mahasiswaprofiles:
    type: rest
    prefix: /api
    resource: "@AisMahasiswaProfileBundle/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