Download the PHP package saro0h/media-api-bundle without Composer
On this page you can find all versions of the php package saro0h/media-api-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download saro0h/media-api-bundle
More information about saro0h/media-api-bundle
Files in saro0h/media-api-bundle
Package media-api-bundle
Short Description Api to upload files.
License MIT
Informations about the package media-api-bundle
Saro0h\MediaApiBundle
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 media
with the file as showed below:
If you can also choose the name of the file uploaded by supplying the field filename
:
Get a media
- GET /media/api/{id}
Delete a media
- DELETE /media/api/get/{id}
License
This bundle is licensed under the MIT license.
All versions of media-api-bundle with dependencies
sensio/framework-extra-bundle Version ~3.0
doctrine/orm Version ~2.2,>=2.2.3
doctrine/doctrine-bundle Version ~1.2
symfony/monolog-bundle Version ~2.4
jms/serializer-bundle Version ~1.0
willdurand/hateoas-bundle Version 1.0.*@dev