Download the PHP package elhardoum/meta-php without Composer
On this page you can find all versions of the php package elhardoum/meta-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elhardoum/meta-php
More information about elhardoum/meta-php
Files in elhardoum/meta-php
Package meta-php
Short Description Makes it easier saving meta data into the database, inspired by WordPress meta (users, options, posts, etc.)
License GPL-2.0
Informations about the package meta-php
Meta data PHP
Makes it easier saving meta data into the database, inspired by WordPress meta (users, options, posts, etc.)
About
This helper class allows you to save custom meta data into the database, and makes manipulating and retrieving these data quite easier, and the performance is a bonus.
By default, once you update a meta, or retrieve it for the first time, it is stored into a global variable to avoid multiple queries.
From my setup, I have Redis configured and it's easier to cache these meta for performance that rocks.
Installation
- Require the package with composer:
composer require "elhardoum/meta-php:*@dev"
-
Create the
meta
table: -
Define the database credentials, and include the
loader.php
file into your setup - Now enjoy the API!
API
You can basically store any type of object using follows API. The data is serialized before saving and unserialized after retrieving. No data sanitization or escaping required, PDO handles that for you.
This repository ships with the default metadata functions on the global namespace. Here's some use:
-
Options
-
User Meta
- Post Meta
You are free to create a custom group and use it.
To use the class Meta
(MetaPHP\Meta
), make sure also the database class Database
(same namespace) is included as well.
... more to come.