Download the PHP package alnaggar/mujam without Composer

On this page you can find all versions of the php package alnaggar/mujam. 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 mujam

Mujam - A Translation Manager

Latest Stable Version Total Downloads License

Mujam is a Laravel translation management package that provides a flexible way to handle translations in your application. It supports various translation stores and allows for easy customization.

The name "Mujam" translates to "dictionary" or "lexicon" in Arabic, which reflects the purpose of the package as a translation management tool.

Table of Contents

Requirements

Installation

Install the package using Composer:

Then, publish the configuration file:

[!NOTE]
If you intend to use the database store, publish the default migrations or create your own and update config/mujam.php accordingly.

Configuration

The configuration file config/mujam.php contains the following keys:

Flat and Structured Stores

Mujam supports the two types of translation stores to suit different project needs:

  1. Flat Stores: These stores use a simple key-value structure, ideal for straightforward translations. A common example is the JSON store, where translations are stored in a flat format, making it easy to access and modify individual key-value pairs.

  2. Structured Stores: These stores offer a more organized approach by supporting namespaces and groups, allowing for better organization and scalability. The PHP store is a typical example, where translations are structured within files, grouped by namespace and language, providing a more modular and hierarchical way to manage translations.

Usage

To integrate Mujam into your application, you can use its translation features through the facade or by utilizing the mujam() helper function.

You can call functions directly on the facade to interact with the default store, or use the store() method to target a specific store.

Below are examples of how to utilize the facade functions:

Retrieving Translation

Retrieve the translation for the specified key and locale, or null if not found.

If locale is null, the current application locale is used.

The fallback parameter controls fallback behavior:

Both flat and structured stores use the same function signature. Simply provide the translation key and the locale to get the translation for.

Retrieving Translations

For Flat Store:

If locale is null, the current application locale is used.

The fallback parameter controls fallback behavior:

For Structured Store:

The namespace can be set to * to indicate the default namespace.

The locale parameter works the same as for the flat store.

The fallback parameter works the same as for the flat store.

Adding Translations

For Flat Store:

The translations are provided as an associative array, where keys are the translation keys and values are the corresponding translation strings.

The locale parameter determines for which locale the translations should be added:

For Structured Store:

The translations parameter works the same as for the flat store.

The namespace can be set to * to indicate the default namespace.

The locale parameter works the same as for the flat store.

Updating Translations

For Flat Store:

The translations are provided as an associative array, where keys are the translation keys and values are the corresponding translation strings.

The locale parameter specifies the locale for which translations should be updated:

For Structured Store:

The translations parameter works the same as for the flat store.

The namespace can be set to * to indicate the default namespace.

The locale parameter works the same as for the flat store.

Removing Translations

For Flat Store:

The keys parameter is an array of keys where each key represents a specific translation that will be removed.

The locale parameter specifies the locale for which translations should be removed:

For Structured Store:

The items parameter is an array of keys where each key represents a specific translation that will be removed.

The namespace can be set to * to indicate the default namespace.

The locale parameter works the same as for the flat store.

Flushing Store

For Flat Store:

The locale parameter specifies the locale for which translations should be removed:

For Structured Store:

The group can be set to * to indicate all groups.

The namespace parameter specifies the namespace for which translations should be removed:

The locale parameter specifies the locale for which translations should be removed:

Checking Translation Existence

Check if a translation exists for the specified key and locale.

If locale is null, the current application locale is used.

Both flat and structured stores use the same function signature. Simply provide the translation key and the locale to check for the translation.

Getting Store Structure

For Flat Store:

For retrieving an array of locales that have available translations:

For Structured Store:

For retrieving store structure:

Laravel Translation Functions

You can also use Laravel's __ helper function or any other translation retrieval function, which will fetch translations from the provided and enabled stores.

[!NOTE] If multiple stores provide a translation for the same key, the last one defined will override the previous ones.

Stores

Database Store

JSON Store

MO Store

PHP Store

PO Store

XLIFF Store

YAML Store

Creating Custom Store

You can register a new driver within the boot method of one of your application's service providers. To accomplish this, you should use the extend method of the Mujam facade:

Caching

All translation stores in Mujam support caching to improve performance and reduce repeated file or database reads. Caching behavior is fully configurable through the cache key in each store’s configuration.

Caching can be customized per store to control how long translations remain valid, where they are stored, and how cache keys are organized.

Example PHP cache configuration:

Caching can be disabled by setting enabled to false, or by setting the entire cache key to false.

Contributing

If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the GitHub repository.

Credits

License

Mujam is open-sourced software licensed under the MIT license.


All versions of mujam with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
ext-json Version *
alnaggar/php-translation-files Version ^1.0
illuminate/contracts Version >=8.0
illuminate/database Version >=8.0
illuminate/support Version >=8.0
illuminate/translation Version >=8.0
symfony/finder Version >=5.4
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 alnaggar/mujam contains the following files

Loading the files please wait ...