Code Monkey home page Code Monkey logo

pulsar's Introduction

Pulsar ORM

Latest Stable Version Software License Build Status Coverage Status Scrutinizer Code Quality Total Downloads

Pulsar is an ORM implementing the Active Record pattern in PHP.

Getting Started

Requirements

The main requirement is that PHP version 8.1 or later is used. The library depends on PDO or Doctrine DBAL to interact with the database.

Installation

The easiest way to install Pulsar is with composer:

composer require pulsar/pulsar

Using Pulsar

See the Pulsar Documentation for more information on how to use the library.

Developing

Tests

Use phpunit to run the included tests:

vendor/bin/phpunit

Contributing

Please feel free to contribute by participating in the issues or by submitting a pull request. :-)

License

The MIT License (MIT)

Copyright © 2015 Jared King

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

pulsar's People

Contributors

andrew-invoiced avatar andriy-invoiced avatar jaredtking avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

pulsar's Issues

Extra refresh() call when retrieving dynamic properties

When accessing a dynamic property in get() it will be treated as a missing property and call refresh(). The model should only be hydrated when there are missing properties that are persisted, and not just missing random properties. Or else should keep track of whether the model has already been hydrated before calling refresh.

Guarded properties

An evolution of the mutable setting. Properties should be allowed optional protection from mass assignment (create([]) and set()). Any violation would throw an exception.

Remove explicit property mapping

Properties should be inferred from the persisted values (or unsaved/default values if not persisted yet). Since properties can be hidden or appended then there is no longer a solid need to define a list of properties available on a model. This would drastically simplify model code. Since the schema is already defined in the data layer there is no need to re-define it at the ORM level.

Once #12, #13, and #16 are completed then $properties and associated methods can be removed.

Look up errors by property

Errors should be added with add() and stored by property. A list of errors for a property can then be retrieved with errors[property]. The all() method should retrieve all error messages.

Date type

The date type should be a DateTime object instead of a unix timestamp

Eliminate DI container in DatabaseDriver

There's no need to give DatabaseDriver access to a whole DI container. There should be a way to inject a lazy-loaded PDO instance instead of relying on the db service.

Better relationship support

TODO:

  • make relationships accessible via dynamic properties
  • include relationships in toArray() with $appended
  • save() method for adding models to a relationship
  • create() method to build and save relationship models
  • attach() and detach() methods for adding or removing models to relationships
  • sync() to delete any models within the list of matching IDs

Custom date formats

Date formats are going to be implementation- or database-specific. Currently dates are pegged to MySQL timestamp column format.

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.