Download the PHP package michaldudek/knit-bundle without Composer

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

Knit Bundle

Knit ties your PHP objects with your database of choice in a simple way. Read more about Knit in its repository.

This is a Symfony3 Bundle that integrates Knit with the framework.

Build Status SensioLabsInsight

Installation

Require the bundle:

$ composer require michaldudek/knit-bundle

Enable the bundle in your Kernel:

<?php

// ...

    public function registerBundles()
    {
        $bundles = [
            // ...

            new Knit\Bundle\KnitBundle(),
        ];
        // ...
    }

Configuration

Add knit section to your config.yml.

There are three available settings and all of them are just names of services you want injected to the main Knit\Knit class (those will serve as defaults for all repositories).

knit:
    # required, default store
    store: [store.service_name]

    # optional, default data mapper, "knit.data_mapper.array_serializer" by default
    data_mapper: [data_mapper.service_name]

    # optional, event dispatcher used, "event_dispatcher" by default
    event_dispatcher: [event_dispatcher.service_name]

Configuring a Store

As you can see, for Knit, a store is nothing more than a dependency that needs to be injected. This gives you power to configure your stores in any way you want.

For convenience, KnitBundle registers two dependencies for the two stores it implements so far: knit.store.doctrine_dbal.criteria_parser and knit.store.mongodb.criteria_parser. It also registers two parameters for easier resolution of store classes: %knit.store.doctrine_dbal.class% and %knit.store.mongodb.class%.

Using these two aspects you can easily configure your data stores and register them in the container:

services:

    mysql_store:
        class: %knit.store.doctrine_dbal.class%
        arguments:
            - driver: pdo_mysql
              user: %db.username%
              password: %db.password%
              host: %db.host%
              dbname: %db.database%
            - @knit.store.doctrine_dbal.criteria_parser
            - @logger

    # or

    mongodb_store:
        class: %knit.store.mongodb.class%
        arguments:
            - hostname: %mongo.host%
              database: %mongo.database%
              username: %mongo.username%
              password: %mongo.password
            - @knit.store.mongodb.criteria_parser
            - @logger

where all the connection parameters you have to register yourself, obviously.

Then in config.yml you can just specify:

knit:
    store: mysql_store    # or mongodb_store

Repositories

By convention, all repositories should be registered as services. You are going to inject them into other services or controllers anyway, so for clarity KnitBundle doesn't automagically creates them.

An example definition of a repository is like this:

user.repository:
    parent: knit.repository
    arguments: [MyApp\User, "users"]

where 1st argument is the managed object class name and second a collection name. Additional arguments are also allowed - see Knit documentation for details on what they are.

License

MIT, see LICENSE.md.

Copyright (c) 2015 Michał Pałys-Dudek


All versions of knit-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
michaldudek/knit Version 0.2.*
symfony/symfony 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 michaldudek/knit-bundle contains the following files

Loading the files please wait ....