Download the PHP package perfectneeds/media-bundle without Composer

On this page you can find all versions of the php package perfectneeds/media-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package media-bundle

Getting Started With PNMediaBundle for manage uploading files like images or documents

Prerequisites

  1. Symfony 3.4
  2. PNServiceBundle

Installation

Installation is a quick (I promise!) 9 step process:

  1. Download PNMediaBundle using composer
  2. Enable the Bundle in AppKernel
  3. Create your Image class
  4. Create your Document class
  5. Create your ImageRepository class
  6. Create your DocumentRepository class
  7. Configure the PNMediaBundle
  8. Import PNMediaBundle routing
  9. Update your database schema

    Step 1: Download PNMediaBundle using composer

    Require the bundle with composer:

Step 2: Enable the Bundle in AppKernel

Require the bundle with composer:

Step 3: Create your Image class

The goal of this bundle is to persist some Image class to a database. Your first job, then, is to create the Image class for your application. This class can look and act however you want: add any properties or methods you find useful. This is your Image class.

The bundle provides base classes which are already mapped for most fields to make it easier to create your entity. Here is how you use it:

  1. Extend the base Image class (from the Entity folder if you are using any of the doctrine variants)
  2. Map the id field. It must be protected as it is inherited from the parent class.

Caution!

When you extend from the mapped superclass provided by the bundle, don't redefine the mapping for the other fields as it is provided by the bundle.

In the following sections, you'll see examples of how your Image class should look, depending on how you're storing your posts (Doctrine ORM).

Note

The doc uses a bundle named MediaBundle. However, you can of course place your post class in the bundle you want.

Caution!

If you override the construct() method in your Image class, be sure to call parent::construct(), as the base Image class depends on this to initialize some fields.

Doctrine ORM Image class

If you're persisting your post via the Doctrine ORM, then your Image class should live in the Entity namespace of your bundle and look like this to start:

*You can add all relations between other entities in this class

Step 4: Create your Document class

The goal of this bundle is to persist some Document class to a database. Your first job, then, is to create the Document class for your application. This class can look and act however you want: add any properties or methods you find useful. This is your Document class.

The bundle provides base classes which are already mapped for most fields to make it easier to create your entity. Here is how you use it:

  1. Extend the base Document class (from the Entity folder if you are using any of the doctrine variants)
  2. Map the id field. It must be protected as it is inherited from the parent class.

Caution!

When you extend from the mapped superclass provided by the bundle, don't redefine the mapping for the other fields as it is provided by the bundle.

In the following sections, you'll see examples of how your Document class should look, depending on how you're storing your documents (Doctrine ORM).

Note

The doc uses a bundle named MediaBundle. However, you can of course place your document class in the bundle you want.

Caution!

If you override the construct() method in your Document class, be sure to call parent::construct(), as the base Document class depends on this to initialize some fields.

Doctrine ORM Document class

If you're persisting your document via the Doctrine ORM, then your Document class should live in the Entity namespace of your bundle and look like this to start:

*You can add all relations between other entities in this class

Step 5: Create your ImageRepository class

You can use this Repository to add any custom methods

Step 6: Create your DocumentRepository class

You can use this Repository to add any custom methods

Step 7: Configure the PNMediaBundle

Add the following configuration to your config.yml file according to which type of datastore you are using.

Step 8: Import PNMediaBundle routing files

Step 9: Update your database schema

Now that the bundle is configured, the last thing you need to do is update your database schema because you have added a new entity.


How to use PNMediaBundle

  1. How to upload image in Controller
  2. How to upload document in Controller

    1. How to upload image in Controller

2. How to upload document in Controller

Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker.

When reporting a bug, it may be a good idea to reproduce it in a basic project built using the Symfony Standard Edition to allow developers of the bundle to reproduce the issue by simply cloning it and following some steps.


All versions of media-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
symfony/framework-bundle Version ~4.0|~5.0|~6.0
perfectneeds/service-bundle Version ~2.0
ext-gd Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package perfectneeds/media-bundle contains the following files

Loading the files please wait ....