Download the PHP package ziadoz/silex-capsule without Composer

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

Silex Capsule Service Provider

Note: This repository is no longer maintained, as the Silex has ended in favour of Symfony 4 Flex.

This is a service provider for the Silex Micro Framework that integrates Laravel's Eloquent ORM via Capsule, its standalone wrapper implementation.

Requirements

In order to use the service provider you'll need to be running PHP 5.5.9+

Installation

The best way to install the service provider is using Composer:

`

Alternatively, you can add it directly to your composer.json file:

`

Basic Usage

To use it in your application just register the service provider with Silex:

``

For more information about the available options you should refer to the Capsule documentation.

Once you've registered the service provider a Capsule object will be created and Eloquent booted up before any of your route controllers are called. If you're interested in the technical aspects, Capsule is registered as before middleware with Silex using Application::EARLY_EVENT, so it'll only ever be made available once your application is run and before anything else happens.

If you need Capsule and Eloquent to be booted up before your application is run ($app->run()), for example in a Symfony Console command, you just need to access its array element within the dependency injection container:

``

Capsule will be made available globally by default, allowing you to write queries directly in your controllers should you wish:

``

If you don't want Capsule to be booted then set the capsule.global setting to false. If you don't plan to use Eloquent to build models then you can also prevent it from being booted by setting capsule.eloquent to false.

Creating Eloquent models is identical to how you would create them in Laravel:

``

Then you can use it, and all of its features, in your controllers just like you would in Laravel:

``

Advanced Usage

You can setup multiple connections and even caching with the service provider; simply use the capsule.connections option:

``

If you've enabled query logging on your connection you can retrieve it through Capsule:

``

You can toggling query logging on a per-connection basis using the logging option in your connection credentials.

You can also use Eloquent's schema building tools to build migrations:

``

By default the service provider installs the Laravel Events package, so you can also use model observers:

``

Capsule Options Example

The following is a full example of all the available options that you can pass to the service provider:

``

Testing

There are some basic tests to ensure that the Capsule object is correctly registered with Silex. You can run them using PHPUnit, and you'll also need SQLite as the tests use a simple in-memory database.

If you make a pull request please ensure you add the accompanying tests.


All versions of silex-capsule with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
silex/silex Version ~2.0
pimple/pimple Version ~3.0
illuminate/database Version ~5.0
illuminate/events Version ~5.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 ziadoz/silex-capsule contains the following files

Loading the files please wait ....