Download the PHP package neatous/doctrine-extensions-translatable without Composer

On this page you can find all versions of the php package neatous/doctrine-extensions-translatable. 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 doctrine-extensions-translatable

Doctrine Extensions: Translatable

A Doctrine extension for managing translatable entities and their translations. This library was extracted from the KnpLabs/DoctrineBehaviors project to provide a more lightweight solution for translatable behavior.

Installation

This library is available via Composer.

First, make sure you have Composer installed. If not, you can follow the instructions here.

Then, require the package in your project:

This command will add neatous/doctrine-extensions-translatable to your composer.json file and install the necessary dependencies, including doctrine/orm, doctrine/persistence, doctrine/collections, and nette/utils.

Usage

1. Define your Translatable Entity

Your translatable entity should use the TranslatableTrait and implement TranslatableInterface.

2. Define your Translation Entity

Each translatable entity needs an associated translation entity. This entity will hold the translatable fields for a specific locale. It should use TranslationTrait and implement TranslationInterface.

3. Configure Doctrine Mapping

The EventSubscriber will automatically map the one-to-many relationship between your translatable entity and its translations. However, you need to ensure Doctrine can find your entities.

Make sure your YourEntity class includes a constructor that calls initializeTranslationsCollection():

And your YourEntityTranslation class should specify its translatable entity class:

4. Register the Event Subscriber

You need to register the EventSubscriber in your Doctrine configuration. This is typically done in your dependency injection container.

You will also need to provide an implementation of LocaleProviderInterface.

Example (Symfony services.yaml):

Example MyLocaleProvider.php:

5. Using Translatable Entities

Now you can interact with your translatable entity:

Contributing

Contributions are welcome! Please feel free to open issues or pull requests on the GitHub repository.

License

This library is open-sourced under the MIT License.


All versions of doctrine-extensions-translatable with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
doctrine/orm Version ^2.14 || ^3.0
doctrine/collections Version ^2.0
doctrine/persistence Version ^3.0 || ^4.0
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 neatous/doctrine-extensions-translatable contains the following files

Loading the files please wait ...