GithubHelp home page GithubHelp logo

nawer / wouterjeloquentbundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wouterj/wouterjeloquentbundle

0.0 1.0 0.0 253 KB

Integrates the Eloquent ORM in the Symfony framework

License: MIT License

PHP 97.56% HTML 2.44%

wouterjeloquentbundle's Introduction

WouterJEloquentBundle

The WouterJEloquentBundle claims to integrate the Eloquent ORM into the Symfony framework.

If you wish to use the Symfony Serializer with Eloquent Models you can check EloquentSerializer.

Build Status

Supported Symfony versions

This bundle is only guaranteed to work on the latest minor releases of the 2.x, 3.x and 4.x version of Symfony. While other minor releases might be supported, support for it isn't explicitly tested. Contribute to this repository to this repository if you want to add support for lower versions.

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require wouterj/eloquent-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

If you're using Symfony Flex, the previous step already got you up and running and you can skip this step! Otherwise, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new WouterJ\EloquentBundle\WouterJEloquentBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Configure the Database

To use the Eloquent ORM, configure a connection by setting the correct environment variables in .env:

# .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=symfony
DB_USERNAME=root
DB_PASSWORD=s3cr3t

If you're not using Symfony Flex, create the configuration file yourself:

# config/packages/eloquent.yaml
wouterj_eloquent:
    driver:   mysql
    host:     localhost
    database: db_name
    username: root
    password: pass
    prefix:   ~

For more information, refer to the documentation below.

Table of Content

  1. Installation
    1. Step 1: Download the Bundle
    2. Step 2: Enable the Bundle
    3. Step 3: Configure the Database
  2. Usage
    1. Query Builder
    2. Eloquent ORM
    3. Using Services instead of Facades
  3. Migrations and Seeding
    1. Running seeders
    2. Setting up
    3. Generating migrations
    4. Running migrations
    5. Rolling migrations
    6. Refreshing the database
  4. Using Models in Forms
    1. Binding the Object to the Form
    2. Form Type Guessing
    3. Form Validation
  5. Events and Observers
    1. Register Listeners
    2. Observers
      1. Observers as Services
  6. Configuration
    1. Full configuration
    2. Connections
      1. Drivers
      2. Default connection
    3. Eloquent
    4. Aliases
  7. License
  8. Contributing
  9. Backwards Compatibility

License

This project is licensed under the MIT license. For more information, see the license file included in this bundle.

Contributing

I love contributors. You can submit fixes, report bugs, share your opinion, advocate this bundle or just say "hello". I welcome anything that makes this project better.

Backwards Compatibility

This bundle follows SemVer, meaning that no minor (1.x) release will contain BC breaks. A new major version is released as soon as BC breaks are introduced. These will be explained in detail in the UPGRADE-*.md file shipped with the source code.

Classes or methods with the @internal PHPdoc annotation are not meant to use or extend. Backwards compatibility is not guaranteed. Classes or methods with the @final PHPdoc annotation are only meant for usage. Backwards compatibility when extending these classes is not guaranteed.

wouterjeloquentbundle's People

Contributors

wouterj avatar theofidry avatar duayres avatar fragkp avatar javiereguiluz avatar richtermeister avatar fabpot avatar mariano-gomez avatar nouwaarom avatar rivomanana avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.