Download the PHP package leroy-merlin-br/mongolid-laravel without Composer

On this page you can find all versions of the php package leroy-merlin-br/mongolid-laravel. 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 mongolid-laravel

Build Status Coverage Status Latest Stable Version Monthly Downloads Latest Unstable Version License

MongoLid

MongoLid (Laravel Package)

Introduction

MongoLid ODM (Object Document Mapper) provides a beautiful, simple implementation for working with MongoDB. Each database collection can have a corresponding "Model" which is used to interact with that collection.

Note: The ODM implementation is within the (non laravel) mongolid repository.

Installation

Install with composer require (use one of the above tags if needed).

Note: Mongolid Laravel 2.0 only supports Laravel 5.4+. For older versions use the tags:

Make sure to set minimum stability to dev when using a beta tag (composer config minimum-stability dev).

Note: If you are using Laravel 5.5, the next steps for providers and aliases are unnecessaries. MongoLid supports Laravel new Package Discovery.

In your config/app.php add 'MongolidLaravel\MongolidServiceProvider' to the end of the $providers array

(Optional) At the end of config/app.php add 'MongoLid' => 'MongolidLaravel\MongoLidModel' to the $aliases array

Lastly, be sure to configure a database connection in config/database.php:

Paste the settings bellow at the end of your config/database.php, before the last ];:

Notice: It must be outside of connections array.

For cluster with automatic failover, you need to set cluster key containing all nodes along with replica_set name.

You can configure as much nodes as needed, node names (e.g. primary and secondary ) are optional.

Note: If you don't specify the mongodb key in your config/database.php MongoLid will automatically try to connect to '127.0.0.1:27017' and use a database named 'mongolid'.

You may optionally provide a connection_string key to set a fully-assembled connection string that will override all other connection options. More info about connection string are found in MongoDB documentation.

Also, it is possible to pass options and driver_options to MongoDB Client. Mongolid always overrides typeMap configuration of driver_options to array because it makes easier to use internally with models. Possible options and driver_options are present on MongoDB\Client documentation.

Basic Usage

To get started, create an MongoLid model. Models typically live in the app/models directory, but you are free to place them anywhere that can be auto-loaded according to your composer.json file.

Defining a MongoLid Model

In a nutshell, that's it!

For further reading about models, CRUD operations, relationships and more, check the Read the Docs: leroy-merlin-br.github.com/mongolid.

Mongolid Docs

Authentication

MongoLid Laravel comes with a Laravel auth provider. In order to use it, simply change the 'driver' provider value in your config/auth.php to mongolid and make sure that the class specified in model is a MongoLid model that implements the Authenticatable contract:

The User model should implement the Authenticatable interface:

Now, to log a user into your application, you may use the auth()->attempt() method. You can use any method regarding authentication.

Queue Failed Job Provider

Mongolid Laravel replaces Laravel queue failed job provider to use a collection instead of a table. To configure the provider, update failed key on queue.php to include collection name:

Note: database key is irrelevant.

Troubleshooting

"PHP Fatal error: Class 'MongoDB\Client' not found in ..."

The MongoDB\Client class is contained in the MongoDB PHP Library and it requires MongoDB driver for PHP. Here is an installation guide for this driver. The driver is a PHP extension written in C and maintained by MongoDB. MongoLid and most other MongoDB PHP libraries utilize it in order to be fast and reliable.

"Class 'MongoDB\Client' not found in ..." in CLI persists even with MongoDB driver installed.

Make sure that the php.ini file used in the CLI environment includes the MongoDB extension. In some systems, the default PHP installation uses different .ini files for the web and CLI environments.

Run php --ini in a terminal to check the .ini that is being used.

To check if PHP in the CLI environment is importing the driver properly run php -i | grep mongo in your terminal. You should get output similar to:

"This package requires php >=7.0 but your PHP version (X.X.X) does not satisfy that requirement."

The new (and improved) version 2.0 of Mongolid Laravel requires php7. If you are looking for the old PHP 5.x version, or other Laravel versions, head to the v0.8 branch.

License

MongoLid & MongoLid Laravel are free software distributed under the terms of the MIT license. Some of the code is based on the work of Taylor Otwell and contributors on laravel/framework, another free software distributed under the terms of the MIT license.

Additional information

Mongolid was proudly built by the Leroy Merlin Brazil team. See all the contributors.

Any questions, feel free to contact us.

Any issues, please report here.


All versions of mongolid-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
leroy-merlin-br/mongolid Version v3.7
illuminate/support Version ^9.0 || ^10.0
illuminate/auth Version ^9.0 || ^10.0
illuminate/queue Version ^9.0 || ^10.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 leroy-merlin-br/mongolid-laravel contains the following files

Loading the files please wait ....