Download the PHP package tylersriver/php-simple-sql without Composer
On this page you can find all versions of the php package tylersriver/php-simple-sql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tylersriver/php-simple-sql
More information about tylersriver/php-simple-sql
Files in tylersriver/php-simple-sql
Package php-simple-sql
Short Description A simple self managed wrapper for MySQLi in PHP
License MIT
Informations about the package php-simple-sql
1 SimpleSQL
A simple self managed wrapper for MySQLi in PHP. This class is useful for small websites with a single DB connection.
1.1 Why?
I have been making some small personal websites and I wanted a way to minimize the amount of code it took to use MySQLi and still have the security to help prevent sql injection. I have reduced it to a single function call with this class.
1.2 Features
- Singleton maintains single connection
- Simple to use
- single flexible query function
- It runs any query (Select, Update, Delete, Insert) and it will parameterize the query
- Inserts return the insert id
1.3 Example
1.3.1 Defining MySQL Server Constants
These constants will be used by the SQL class
1.3.2 Using the class
2 SimpleORM
A simple extendable class for making Database calls. Using a model you can encapsulate your SQL queries to a class. It also provides basic CRUD functions.
2.1 Features
- CRUD Functions
- Get - Gets a record from the table by id
- GetList - Gets a list of records by a simple where filter
- GetOne - Returns 1 record from GetList
- Add - Inserts a record
- Update - updates a record by id
- UpdateMany - updates records by simple where filter
- Delete - deletes record by id
- DeleteMany - deletes records by where filter
- Easy to use a setup
- Simple encapsulation for Database operations
- Wraps the SimpleSQL class for MySQLi
2.2 Example
This is a quick use case. More examples of each CRUD Function in the test directory.