{"id":22056013,"url":"https://github.com/intelligenia/lulo","last_synced_at":"2025-05-12T16:01:33.897Z","repository":{"id":56992377,"uuid":"59437739","full_name":"intelligenia/lulo","owner":"intelligenia","description":"A minimal ORM for PHP inspired by Django","archived":false,"fork":false,"pushed_at":"2017-04-20T10:42:30.000Z","size":1552,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-07T18:56:28.635Z","etag":null,"topics":["database","dbms","mysql","orm","php","twig"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intelligenia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-22T22:42:19.000Z","updated_at":"2023-10-05T02:09:12.000Z","dependencies_parsed_at":"2022-08-21T12:50:53.312Z","dependency_job_id":null,"html_url":"https://github.com/intelligenia/lulo","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelligenia%2Flulo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelligenia%2Flulo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelligenia%2Flulo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelligenia%2Flulo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intelligenia","download_url":"https://codeload.github.com/intelligenia/lulo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253772892,"owners_count":21962185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","dbms","mysql","orm","php","twig"],"created_at":"2024-11-30T16:12:17.420Z","updated_at":"2025-05-12T16:01:33.840Z","avatar_url":"https://github.com/intelligenia.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lulo\nA minimal ORM for PHP inspired by Django.\n\n# What's this?\nThis is a small and easy to use ORM based on Django's ORM API for PHP.\n\n# Requirements\nPHP 5.4 and dependencies installed by [composer](https://getcomposer.org/) ([AdoDB](http://adodb.org/dokuwiki/doku.php) and [Twig template system](http://twig.sensiolabs.org/)).\n\n# Installation\n\n[lulo has been uploaded to packagist.org](https://packagist.org/packages/intelligenia/lulo) can be easilly installed with composer:\n\n```sh\ncomposer require intelligenia/lulo\n```\n\n# Documentation\n\n## Local configuration\nCreate a configuration.local.php in your web server with the structure defined in configuration.local.example.php.\n\nThis file must contain access credential to your database as seen in the example:\n\n```php\nfunction get_db_settings(){\n    $db_settings = [\n        \"server\" =\u003e \"\u003cDB SERVER\u003e\",\n        \"user\" =\u003e \"\u003cDB USER\u003e\",\n        \"password\" =\u003e \"\u003cDB PASSWORD\u003e\",\n        \"database\" =\u003e \"\u003cDATABASE\u003e\"\n    ];\n    return $db_settings;\n}\n```\n\nThis local configuration file will be loaded automatically from **configuration.php** and will be used to access database.\n\n## API\n\n- [Models](docs/models.md)\n- [API](docs/model_api.md)\n- [Queries](docs/queries.md)\n\nExtended documents:\n- [Lulo](docs/Lulo-ES.pdf)\n- [LuloQuery](docs/LuloQuery-ES.pdf)\n\n\n# Examples\n\nThere is a test module gives you several examples of using Lulo and its query system.\n\n```php\n/**\n * Example user class for a social-network-like system.\n * @author Diego J. Romero López at intelligenia.\n * */\nclass User extends \\lulo\\models\\LuloModel{\n\t\n\t/** Model table */\n\tconst TABLE_NAME = \"user\";\n\t\n\t/** Class name*/\n\tconst CLASS_NAME = __CLASS__;\n\t\n\t/**\n\t * Metainformation of the class\n\t * */\n\tpublic static $META = [\n\t\t// Description of the model\n\t\t\"model_description\" =\u003e \"Test user\",\n\t\t// Verbose name\n\t\t\"verbose_name\" =\u003e \"test user\",\n\t\t// Verbose name (plural)\n\t\t\"verbose_name_plural\" =\u003e \"test users\",\n\t\t// Gender of the verbose name\n\t\t\"gender\" =\u003e \"m\",\n\t\t// Order in lists ([\"field1\"=\u003e\"ASC|DESC\", \"field2\"=\u003e\"ASC|DESC\", ...])\n\t\t\"order\" =\u003e [\"username\"=\u003e\"ASC\"]\n\t];\n\t\n\t/**\n\t * Model attributes\n\t * */\n\tprotected static $ATTRIBUTES = [\n\t\t// Primary key\n\t\t\"stack\"=\u003e[\"type\"=\u003e\"string\", \"default\"=\u003eTEST_STACK, \"verbose_name\"=\u003e\"User dependant stack\", \"auto\"=\u003etrue],\n\t\t\"id\" =\u003e [\"type\"=\u003e\"int\", \"verbose_name\"=\u003e\"Identificador único del usuario\", \"auto\"=\u003etrue],\n\t\t\n        \t// Proper user fields\n\t\t\"first_name\" =\u003e [\"type\"=\u003e\"string\", \"verbose_name\"=\u003e\"Name\", \"access\"=\u003e\"rw\"],\n\t\t\"last_name\" =\u003e [\"type\"=\u003e\"string\", \"verbose_name\"=\u003e\"Family name\"],\n\t\t\"email\" =\u003e [\"type\"=\u003e\"string\", \"subtype\"=\u003e\"email\", \"verbose_name\"=\u003e\"E-Mail\"],\n\t\t\"phone\" =\u003e [\"type\"=\u003e\"string\", \"subtype\"=\u003e\"phone\", \"verbose_name\"=\u003e\"User telepohone number\", \"null\"=\u003etrue, \"default\"=\u003enull],\n\t\t\"username\" =\u003e [\"type\"=\u003e\"string\", \"subtype\"=\u003e\"username\", \"verbose_name\"=\u003e\"Username\"],\n\t\t\"sha1_password\" =\u003e [\"type\"=\u003e\"string\", \"verbose_name\"=\u003e\"Password\"],\n\t\t\n        \t// Photograph of the user. Stored as a blob in database\n\t\t\"main_photo\" =\u003e [\"type\"=\u003e\"blob\", \"verbose_name\"=\u003e\"User photo\", \"null\"=\u003etrue, \"default\"=\u003enull],\n\t\t\"main_photo_mimetype\" =\u003e [\"type\"=\u003e\"string\", \"verbose_name\"=\u003e\"Mimetype of main_photo\", \"default\" =\u003e\"application/octet-stream\"],\n\t\t\"main_photo_filename\" =\u003e [\"type\"=\u003e\"string\", \"verbose_name\"=\u003e\"Filename of main_photo\", \"null\"=\u003etrue, \"default\"=\u003enull],\n\t\t\n        \t// Datetime fields\n\t\t\"last_update_datetime\" =\u003e [\"type\"=\u003e\"string\", \"subtype\"=\u003e\"datetime\", \"verbose_name\"=\u003e\"Last update of this object\", \"auto\"=\u003etrue],\n\t\t\"creation_datetime\" =\u003e [\"type\"=\u003e\"string\", \"subtype\"=\u003e\"datetime\", \"verbose_name\"=\u003e\"Creation datetime of this object\", \"auto\"=\u003etrue],\n\t];\n\t\n\t\n\t/** Primary key */\n\tprotected static $PK_ATTRIBUTES = [\"stack\", \"id\"];\n\t\n\t\n\t/**\n\t * Related models.\n\t * */\n\tprotected static $RELATED_MODELS = [\"Tag\", \"Photo\", \"Post\"];\n\t\n\t\n\t/** Relationships */\n\tprotected static $RELATIONSHIPS = [\n\t\n\t];\n}\nUser::init();\n```\n\n# Extending Lulo\n\n## Adding new DBMS SQL templates\nAdd a new folder in sql_templates with the name that will identify your DBMS (mssql2012, for example).\n\nOverwrite the queries you need. Lulo template system will first load the templates you\nspecify here and if it doesn't find the template, it will try to load it from the _default\nfolder.\n\n\n# TODO\n\n- ~~Allow models to dynamically change of table.~~ It can be done by reimplementing **getTableName** method.\n- ~~End translation of code to English.~~\n- Translate documents to English.\n- ~~Reimplement Collection to use RecordSet.~~\n- ~~Script for table creation from model.~~ Manager class in management namespace allows creation and deletion of model tables.\n- Migrations.\n\n# License\n[MIT License](LICENSE).\n\n# Authors\n- Lulo and Lulo query created by the team leader and main developer of this project:\nDiego J. Romero López at intelligenia (diegoREMOVETHIS@REMOVETHISintelligenia.com)\n- DB abstraction layer created by several members of intelligenia team. Reviewed and extended by Gerardo Fernandez Rodríguez.\n- QueryResult was done with Gerardo Fernandez Rodríguez.\n- Several bugfixes and tests in MSSQL done by [Francisco Morales](https://github.com/moralesgea).\n- Minor translation fixes done by [Brian Holsters](https://github.com/brian-holsters)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintelligenia%2Flulo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintelligenia%2Flulo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintelligenia%2Flulo/lists"}