Coder Social home page Coder Social logo

feijaovermelho's Introduction

feijaoVermelho

ORM based on RedBeanPHP

naming

"feijão vermelho" simply means "red bean" in portuguese.

idea

Since i am using RedBeanPHP in about a dozen projects or so, i really love the easypeasy possibilities to put objects into databases, read them, change them... A far as you design your objects to use RedBean from ground up, no problem.

What i wanted to archieve with this little lib is to use RedBeanPHP transparantly in the background for mostly an class/object in your projects...

installation

composer require openwebx/feijaovermelho

usage

using it for easy stuff like saving objects to database, fetching objects from database or "upserting" is totally straight forward:

saving your object to database

<?php
use openWebX\feijaoVermelho\feijaoVermelho

class Test {
    // use our trait...
    use feijaoVermelho;
    
    // define some public properties
    public int $intValue;
    public string $stringValue;
}

// now simply let feijaoVermelho do its magic:
$myTest = new Test();
$myTest->intValue = 666;
$myTest->stringValue = 'this is a test';
$myTest->save();

when database is reachable and configured correctly (see configuration...) then there will be a table named "test" with at least one entry with id, int_value and string_value as fields...

loading objects from database

now lets get our object from database:

<?php
[...]
$myNewObject = new Test();
$myNewObject->intValue = 666;
$myNewObject->loadByIntValue();

echo $myNewObject->stringValue; // -> this is a test


    

feijaovermelho's People

Contributors

openwebx avatar

Watchers

 avatar  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.