Leap is a database management library for PHP. It was originally developed to be used in conjunction with the Kohana PHP Framework, but has since evolved and been adapted to work with any PHP framework. It is designed to work with DB2, Drizzle, Firebird, MariaDB, MS SQL, MySQL, Oracle, PostgreSQL, and SQLite. Leap acts as a common interface between the different database dialects and connections. It provides a powerful query builder and ORM. Leap's ORM is based on the active record design pattern, which utilizes PHP objects to model database tables.
Make sure to "Star" this project if you like it.
Leap is meant to be a simple, clean project. The primary goal of Leap is to create a set of query builders and an ORM for any PHP Framework that works with all major database dialects. Implementing Leap is easy and generally more intuitive than other ORMs like Doctrine. A goal for the development of Leap was to create an ORM that can harness the power of composite keys, which many other ORMs (e.g. Kohana's official ORM, Jelly, and Sprig) cannot handle.
Leap provides a number of features, such as:
- Plugins for DB2, Drizzle, Firebird, MariaDB, MS SQL, MySQL, Oracle, PostgreSQL, and SQLite.
- Designed to work in conjunction with other database tools for Kohana.
- Config file for designating the database driver (e.g. PDO) and connection strings.
- Classes are easily extensible.
- A database connection pool for managing resources.
- A powerful query builder for creating SQL statements.
- Sanitizes data to help prevent SQL injection attacks.
- Capable of handling non-integers primary keys.
- Supports composite primary keys and composite foreign keys.
- Enforces strong data types on database fields.
- Allows field aliases to be declared.
- Makes working with certain database fields easy with field adaptors.
- A set of Auth classes for authenticating user logins.
- A toolkit of useful functions.
- Lots of tutorials.
To start using Leap, follow these steps:
- Just clone this repository from github.
- Copy the folder entitled
Leap
, which is in theclasses
folder, to your project. - Add your database connection information to Leap\Config\Database.php.
- Add the classpath to the
Leap
module to your application's bootstrap class loader. - Begin creating your models.
For information on how to install Leap
as a Kohana module, see the tutorial on installing Leap.
The Leap ORM module is meant to be a completely independent module. As for the files within Leap, you can remove any database plugins that you are not using.
This project is accompanied by a companion Web site, which documents the API for the Leap ORM and has a number of examples and tutorials. You can also find other tutorials and examples online (please let us know if you find one that we should highlight here).
Although Leap is simple to use with any PHP Framework, you can get further assistance by asking questions on either Kohana's Forum or Stack Overflow.
If you find a bug in the code or if you would like to make a recommendation, we would be happy to hear from you. Here are three methods you can use to notify us:
- Log an issue in this project's issue tracker.
- Create a fork of this project and submit a pull request.
- Send an email to [email protected].
Please see this project's issue tracker on github for any known issues.
Make sure that you add yourself as a watcher of this project so that you can watch for updates.
This project is constantly being improved and extended. If you would like to contribute to Leap, please fork the project and then send us your additions/modifications using a pull request.
Copyright © 2011–2015 Spadefoot Team.
Unless otherwise noted, Leap is licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.