Download the PHP package reneschmidt/simpleorm without Composer
On this page you can find all versions of the php package reneschmidt/simpleorm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download reneschmidt/simpleorm
More information about reneschmidt/simpleorm
Files in reneschmidt/simpleorm
Package simpleorm
Short Description Simple, no-frills ORM class.
License GPL-3.0
Homepage https://reneschmidt.de/wiki/index.php/page/view/SimpleOrm,Start
Informations about the package simpleorm
SimpleOrm
Immature. Do not use.
This is a no-frills simple ORM class for PHP/sqlite and MySQL. Project goals are to
- provide ORM functionality
- be as simple and small as possible
- be clean.
It is not a goal to be compatible with other DBMS than sqlite and MySQL (at the moment) or to implement feature X that other ORM Y already has. It might not even fit into the traditional ORM paradigm.
German Web Application Developer Available for Hire!
No marketing skills whatsoever, but low rates, nearly 20 years of experience, and german work attitude.
Get in touch now: https://www.sdo.sh/DevOps/#contact
Requirements
PHP 5.3 + php-sqlite
Download
Author
Me:
- https://sdo.sh/
- I am available for hire
Licence
GPL v3 or commercial licence :) from [email protected]. Do not use this in your closed source project without paying me. I don't like that.
How to use
First, SimpleOrm supports sqlite and MySQL at the moment. Secondly, SimpleOrm expects every table to have a numeric PK and it must be given as the first field.
Set variables
Provide database setup class
This is not SimpleOrm-specific. You can do this any way you want. I would recommend a similar setup like in this package: SampleDbConfig. The setUp() method in it creates required tables. Be sure to execute this setup only when the database does not exist yet.
Create model class for each table. Example:
Let's assume you have a table like this:
Then create an appropriate model class like this:
That's it.
How to use
There are different methods of creating new records:
How to retrieve records:
How to update and delete records:
Full example:
Have fun.