development-x/media-service-provider

MediaServiceProvider for Silex framework

2.0.0 2017-03-18 18:39 UTC

This package is auto-updated.

Last update: 2024-12-16 00:43:13 UTC


README

Media Service Provider

Adding media service provider (inspired by SonataMediaBundle)

Features

  • Adding DoctrineORM Entity for hold db records.
  • Customized templates

Requirements

  • PHP 5.3+
  • Pimple ~2.1
  • Doctrine ~2.3

Installation

Install with Composer, run:

composer require development-x/media-service-provider

Register first

<?php

use Silex\Application;

$app->register(new \Media\media-service-provider())

Create entity Media, and extend Base Entity

<?php

namespace App\Entity;

use Media\Entity\Media AS BaseMedia;

/**
 * 
 * @Entity
 * @HasLifecycleCallbacks
 * @Table(name="media_attachments")
 */
class Media extends BaseMedia
{

    /**
     * @var integer
     *
     * @Column(name="id", type="integer")
     * @Id
     * @GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }
}

ToDo

  • Add more functionality
  • Add more unit tests

Contributing

However, if you are interested and want to send a bug fix, new functionality or better realization, just send a pull request :) travis