PHPackages                             emeka/candy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. emeka/candy

ActiveLibrary

emeka/candy
===========

V1.0.0(10y ago)12102MITPHPPHP &gt;=5.5.9

Since Nov 10Pushed 8y ago2 watchersCompare

[ Source](https://github.com/andela-eosuagwu/Candy)[ Packagist](https://packagist.org/packages/emeka/candy)[ RSS](/packages/emeka-candy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

Candy
=====

[](#candy)

[![Build Status](https://camo.githubusercontent.com/f54430d4268eec18ee32b0d7888789da19c577c3a0b506cf6ece50ced7753d1c/68747470733a2f2f7472617669732d63692e6f72672f616e64656c612d656f7375616777752f43616e64792e737667)](https://travis-ci.org/andela-eosuagwu/Candy)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/87e477440153452b70aeec7f165c344955ae89cda3631863e8297c1b90c4ed21/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e64656c612d656f7375616777752f43616e64792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/andela-eosuagwu/Candy/?branch=master)

#### Candy is a lightweight ORM built with php

[](#candy-is-a-lightweight-orm-built-with-php)

\#Testing The phpunit framework for testing is used to perform unit test on the classes. The TDD principle has been employed to make the application robust

Run this on bash to execute the tests

```
 /vendor/bin/phpunit
```

\#Install

- To install this package, PHP 5.5+ and Composer are required

```
composer require emeka/candy
```

\#Basic CRUD Operations All querie requires a Mapper instance. Mappers are responsible for finding and updating or delete individual entities.

\##Queries With Candy

\#all()

- Finds and return all entities from a field in the database.

```
$users = User::all();
echo $users;
```

\#find($id)

- Finds and return single entity from the database.

```
$users = User::find($id);
echo $users;
```

\#where($value, $field) Find all entities that match the given conditions and return records from the database.

```
$value = "username"
$field = "user's table"

echo $user = User::where($value, $field)
```

\#Save

- The save method is a convenience method that handles both inserting and updating an entity object. Save will call either insert or update, depending on whether the Entity has as an `ID` property `isset`.

\####Insert

```
$user = new User;
$user->email     = "john@doe.co";
$user->username  = "john";
$user->password  = "password";
//without the ID property the Save method will insert a new record in to  the database
$user::save();
```

\####Update

```
$user = new User;
$user->id        = 1;
$user->email     = "new_john@doe.co";
$user->username  = "new_john";
$user->password  = "new_password";
//with the ID property the Save method will update the USERS table where ID = 1.
$user::save();
```

\#Delete

- Delete a from the database.

```
$user = User::destroy($id):
$user returns a boolean
```

Change log
----------

[](#change-log)

Please check out [CHANGELOG](CHANGELOG.md) file for information on what has changed recently.

Contributing
------------

[](#contributing)

Please check out [CONTRIBUTING](CONTRIBUTING.md) file for detailed contribution guidelines.

Credits
-------

[](#credits)

Candy is maintained by `Emeka Osuagwu`.

License
-------

[](#license)

Urban dictionary is released under the MIT Licence. See the bundled [LICENSE](LICENSE.md) file for more details.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 98% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3842d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aaf341d1508a15aadbeeff94e5674ec4c13c962ae1e8aebdccd754c882458bce?d=identicon)[Emeka](/maintainers/Emeka)

---

Top Contributors

[![emeka-osuagwu](https://avatars.githubusercontent.com/u/13197724?v=4)](https://github.com/emeka-osuagwu "emeka-osuagwu (50 commits)")[![mattcannon](https://avatars.githubusercontent.com/u/173341?v=4)](https://github.com/mattcannon "mattcannon (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/emeka-candy/health.svg)

```
[![Health](https://phpackages.com/badges/emeka-candy/health.svg)](https://phpackages.com/packages/emeka-candy)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)[doppar/framework

The Doppar Framework

366.7k8](/packages/doppar-framework)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[lion/bundle

Lion-framework configuration and initialization package

122.2k1](/packages/lion-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
