Download the PHP package corllete/silex-mongodb-provider without Composer

On this page you can find all versions of the php package corllete/silex-mongodb-provider. 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 silex-mongodb-provider

silex-mongodb-provider

Build Status codecov Scrutinizer Code
Quality

Silex MongoDB Service Provider - integrates Mongo PHP Library with Silex 2.x

Requirements

Installation

Configuration & Usage

Connection uri defaults to mongodb://localhost:27017. For additional resources about configuration/setup options and library usage, take a look at the Resources section.

Zero Configuration

Container setup

NOTE!

I omit use Corllete\SilexMongoDB\Provider\MongoDBServiceProvider; line in all of the examples below for a sake of simplicity.

Usage

Provide some options

Container setup

Usage

Multiple Connections

Container setup

WARNING!

You have to apply rawurlencode() username and password when used directly in the uri string

Usage

Explicit set default connection via connection name reference

Container setup

Usage

Explicit set default connection - connection label

Container setup

Usage

Assemble uri

Container setup

Few things to keep in mind here:

Container namespace

By default, this service provider is registered in mongodb.* and mongodbs.* container namespace. While reserved by the core parameters and core services namespace is something everyone must live with, I don't feel occupying namespace (e.g. mongodb) from thrid party service providers is a good practice. Exactly this bad feeling made me implement feature (that I personally call) service provider namespace. The logic behind it is extremely simple - you provide single and multi namespace values (following the logic of core DoctrineServiceProvider which takes db and dbs namespaces) to the service provider constructor as respectively first and second argument.

It's a 'behind the scenes' feature, you may or may not use it but most important - you have a choice.

Example - occupy db and dbs namespaces - given there is no registered DoctrineServiceProvider, no space for RDBMS!

Usage

Example - override only single connection namespace to db

Usage

MongoDB Client service factory

If you, for any reason (unknown to me!) decide you need to manually create \MongoDB\Client instance, you may use the registered with MongoDBServiceProvider factory callable.

Factory callable accepts one argument - array of connection configuration options, as they are passed via mongodb.options to the service provider. If no configuration options are passed, $app['mongodb.default_options'] will be used (and you may override it!).

Configuration options, service parameters and services reference

Configuration options

The following describes the options passed to the register() container method (see examples section).

Single connection options

mongodb is the single connection configuration namespace, it may be overridden (see Namespace section). If this happens, you have to substitute it in the examples below.

Multi connection options

mongodbs is the multi connection configuration namespace, it may be overridden (see Namespace section). If this happens, you have to substitute it in the examples below.

Services

Retrievable in your code via $app['SERVICE_NAME'];

Internal

Parameters

Retrieve or override in your code via $app['PARAMETER_NAME'];

Tests

Run phpunit test after composer install

You may also print the coverage

Gotchas

Contribute

Fork me and open a Pull Request. Please don't provide code contribution without test coverage. Single commit Pull Request preffered.

Resources

License

This package is licensed under MIT License

(c) Corllete


All versions of silex-mongodb-provider with dependencies

PHP Build Version
Package Version
Requires php Version ~5.6||~7.0
mongodb/mongodb Version ^1.0.0
pimple/pimple Version ~3.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 corllete/silex-mongodb-provider contains the following files

Loading the files please wait ....