saro0h/media-api-bundle 问题修复 & 功能扩展

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

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

saro0h/media-api-bundle

Composer 安装命令:

composer require saro0h/media-api-bundle

包简介

Api to upload files.

README 文档

README

SensioLabsInsight

This bundle allows you to have an upload of files through an API.

Installation

Step 1: Install MediaApiBundle using Composer

Add MediaApiBundle in your composer.json:

{
    "require": {
        "saro0h/media-api-bundle": "~1.0"
    }
}

Now tell composer to download the bundle by running the command:

$ php composer.phar update saro0h/media-api-bundle

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Saro0h\MediaApiBundle\MediaApiBundle(),
        // ...
    );
}

Step 3: Import the routes of the bundle

Add the following lines to the app/config/routing.yml:

media_api_bundle:
    resource: "@MediaApiBundle/Resources/config/routing.yml"

Step 4: Create the database and the schema

Run the following commands (after configuring the ORM parameters)

app/console doctrine:database:create
app/console doctrine:schema:create

Step 4 (optional): Configure your config.yml file

# app/config/config.yml
media_api:
    media_path: %media_path%    # Path to the folder where the media will be uploaded (by default it's `web/uploads` folder of your project)
    field_name: %filename%      # Name of the field used to supply the file in the form (by default it's "media")

Usage

Upload a file

  • POST /media

If you did not configure the bundle, you just have to POST on the url /media/api/upload the field mediawith the file as showed below: upload

If you can also choose the name of the file uploaded by supplying the field filename: upload_with_filename

Get a media

  • GET /media/api/{id}

get_media

Delete a media

  • DELETE /media/api/get/{id}

delete_media

License

This bundle is licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固