11# PHP ORM Database
22
3- [ ![ Total Downloads] ( https://poser.pugx.org/peterson /database/downloads )] ( https://packagist.org/packages/peterson /database )
4- [ ![ Latest Stable Version] ( https://poser.pugx.org/peterson /database/version.png )] ( https://packagist.org/packages/peterson /database )
5- [ ![ License] ( https://poser.pugx.org/peterson /database/license )] ( https://packagist.org/packages/peterson /database )
6- [ ![ Build Status] ( https://github.com/tamedevelopers/phpOrmDatabase /actions/workflows/php.yml/badge.svg )] ( https://github.com/tamedevelopers/phpOrmDatabase /actions )
7- [ ![ Code Coverage] ( https://codecov.io/gh/peterson /database/branch/2.2.x/graph/badge.svg )] ( https://codecov.io/gh/peterson /database/branch/2.2.x )
8- [ ![ Gitter] ( https://badges.gitter.im/peterson /database.svg )] ( https://app.element.io/#/room/#php-orm-database:gitter.im )
3+ [ ![ Total Downloads] ( https://poser.pugx.org/tamedevelopers /database/downloads )] ( https://packagist.org/packages/tamedevelopers /database )
4+ [ ![ Latest Stable Version] ( https://poser.pugx.org/tamedevelopers /database/version.png )] ( https://packagist.org/packages/tamedevelopers /database )
5+ [ ![ License] ( https://poser.pugx.org/tamedevelopers /database/license )] ( https://packagist.org/packages/tamedevelopers /database )
6+ [ ![ Build Status] ( https://github.com/tamedevelopers/database /actions/workflows/php.yml/badge.svg )] ( https://github.com/tamedevelopers/database /actions )
7+ [ ![ Code Coverage] ( https://codecov.io/gh/tamedevelopers /database/branch/2.2.x/graph/badge.svg )] ( https://codecov.io/gh/tamedevelopers /database/branch/2.2.x )
8+ [ ![ Gitter] ( https://badges.gitter.im/tamedevelopers /database.svg )] ( https://app.element.io/#/room/#php-orm-database:gitter.im )
99
1010## Inspiration
1111
@@ -98,7 +98,6 @@ was pretty tough. So i decided to create a much more easier way of communicating
9898* [ Get Database TablePrefix] ( #get-database-tableprefix )
9999* [ Database Import] ( #database-import )
100100* [ Update Env Variable] ( #update-env-variable )
101- * [ Env Servers] ( #Env-servers )
102101* [ Autoload Register] ( #autoload-register )
103102* [ Collation And Charset] ( #collation-and-charset )
104103* [ Extend Model Class] ( #extend-model-class )
@@ -119,7 +118,7 @@ Prior to installing `php-orm-database` get the [Composer](https://getcomposer.or
119118** Step 1** — update your ` composer.json ` :
120119``` composer.json
121120"require" : {
122- "peterson /database" : " ^4.3.8"
121+ "tamedevelopers /database" : " ^4.3.8"
123122}
124123```
125124
@@ -152,7 +151,7 @@ require_once __DIR__ . '/vendor/autoload.php';
152151| ` .env ` ` .gitignore ` ` .htaccess ` ` .user.ini ` ` init.php ` |
153152
154153```
155- use builder \Database\AutoLoader;
154+ use Tamedevelopers \Database\AutoLoader;
156155
157156AutoLoader::start();
158157```
@@ -176,7 +175,7 @@ autoloader_start('optional_path_to_root');
176175 - All you need do is call the bootloader, to start your application.
177176
178177```
179- use builder \Database\Capsule\AppManager;
178+ use Tamedevelopers \Database\Capsule\AppManager;
180179
181180AppManager::bootLoader();
182181
@@ -937,7 +936,7 @@ $db->table('wallet')
937936| drop() | Drop migration tables |
938937
939938```
940- use builder \Database\Migrations\Migration;
939+ use Tamedevelopers \Database\Migrations\Migration;
941940```
942941
943942### Create Table Schema
@@ -974,7 +973,7 @@ migration()->create('users');
974973| You must define this before start using the migrations |
975974
976975```
977- use builder \Database\Migrations\Schema;
976+ use Tamedevelopers \Database\Migrations\Schema;
978977
979978Schema::defaultStringLength(200);
980979```
@@ -992,7 +991,7 @@ schema()->defaultStringLength(2000);
992991 - ` $values ` as mixed data ` NULL ` ` NOT NULL\|None ` ` STRING ` ` current_timestamp() `
993992
994993```
995- use builder \Database\Migrations\Schema;
994+ use Tamedevelopers \Database\Migrations\Schema;
996995
997996Schema::updateColumnDefaultValue('users_table', 'email_column', 'NOT NULL);
998997Schema::updateColumnDefaultValue('users_table', 'gender_column', []);
@@ -1034,7 +1033,7 @@ migration()->drop();
10341033- Takes one param as ` string ` $table_name
10351034
10361035```
1037- use builder \Database\Migrations\Schema;
1036+ use Tamedevelopers \Database\Migrations\Schema;
10381037
10391038Schema::dropTable('table_name');
10401039
@@ -1050,7 +1049,7 @@ schema()->dropTable('table_name');
10501049- To Drop Column ` takes two param `
10511050 - This will drop the column available
10521051```
1053- use builder \Database\Migrations\Schema;
1052+ use Tamedevelopers \Database\Migrations\Schema;
10541053
10551054Schema::dropColumn('table_name', 'column_name');
10561055
@@ -1095,7 +1094,7 @@ $db->getTablePrefix()
10951094 - Remember the system already have absolute path to your project.
10961095
10971096```
1098- use builder \Database\DBImport;
1097+ use Tamedevelopers \Database\DBImport;
10991098
11001099$database = new DBImport();
11011100
@@ -1113,7 +1112,6 @@ $status = $database->import('path_to/orm.sql');
11131112import('path_to/orm.sql');
11141113```
11151114
1116-
11171115## Update Env Variable
11181116- You can use this class to import .sql into a database programatically
11191117
@@ -1125,7 +1123,7 @@ import('path_to/orm.sql');
11251123| allow_space | ` true ` \| ` false ` - Default is false (Allow space between key and value)|
11261124
11271125```
1128- use builder\Database\Methods \Env;
1126+ use Tamedevelopers\Support \Env;
11291127
11301128Env::updateENV('DB_PASSWORD', 'newPassword');
11311129Env::updateENV('APP_DEBUG', false);
@@ -1138,38 +1136,6 @@ true|false
11381136- or -- ` Helpers Function `
11391137```
11401138env_update('DB_CHARSET', 'utf8', false);
1141- env_orm()->updateENV('DB_CHARSET', 'utf8', false);
1142- ```
1143-
1144-
1145- ## Env Servers
1146- - Returns assoc arrays of Server
1147- - ` server\|domain\|protocol `
1148-
1149- ```
1150- use builder\Database\Env;
1151-
1152- Env::getServers();
1153- ```
1154-
1155- - or -- ` Helpers Function `
1156- ```
1157- env_orm()::getServers('server');
1158- env_orm()->getServers('domain');
1159- ```
1160-
1161- ## Autoload Register
1162- - Takes an ` string\|array ` as param
1163- - You can use register a folder containing all needed files
1164- - This automatically register ` Files\|Classes ` in the folder and sub-folders.
1165-
1166- ```
1167- use builder\Database\AutoloadRegister;
1168-
1169- AutoloadRegister::load('folder');
1170-
1171- or
1172- autoload_register(['folder', 'folder2]);
11731139```
11741140
11751141## Collation And Charset
@@ -1194,7 +1160,7 @@ autoload_register(['folder', 'folder2]);
11941160
11951161- You can as well extends the DB Model class directly from other class
11961162```
1197- use builder \Database\Model;
1163+ use Tamedevelopers \Database\Model;
11981164
11991165class Post extends Model{
12001166
@@ -1217,22 +1183,11 @@ class Post extends Model{
12171183| db_connection() | Same as ` $db->dbConnection() ` |
12181184| config_pagination() | Same as ` $db->configPagination() ` or ` AutoLoader::configPagination ` |
12191185| autoloader_start() | Same as ` AutoLoader::start() ` |
1220- | autoload_register() | Same as ` AutoloadRegister::load() ` |
1221- | env() | Same as ` $db->env() ` |
1222- | env_update() | Same as ` Env::updateENV ` method |
1223- | env_orm() | Return instance of ` (new Env) ` class |
1186+ | env_update() | Same as ` Env::updateENV ` method |
12241187| app_manager() | Return instance of ` (new AppManager) ` class |
12251188| import() | Return instance of ` (new DBImport)->import() ` method |
12261189| migration() | Return instance of ` (new Migration) ` class |
12271190| schema() | Return instance of ` (new Schema) ` class |
1228- | asset() | Return Absolute path of asset. Same as ` Asset::asset() ` |
1229- | asset_config() | Same as ` Asset::config() ` . Configure Asset root directory |
1230- | base_path() | Get absolute base directory path. It accepts a param as ` string ` if given, will be appended to the path |
1231- | directory() | Same as ` base_path() ` just naming difference |
1232- | domain() | Similar to ` base_path() ` as it returns domain URI. Also accepts path given and this will append to the endpoint of URL. |
1233- | to_array() | ` array ` Convert items to array |
1234- | to_object() | ` object ` Convert items to object |
1235- | to_json() | ` string ` Convert items to json |
12361191
12371192## Error Dump
12381193
@@ -1250,6 +1205,7 @@ class Post extends Model{
12501205## Useful Links
12511206
12521207- @author Fredrick Peterson (Tame Developers)
1253- - [ Lightweight - PHP ORM Database] ( https://github.com/tamedevelopers/phpOrmDatabase )
1208+ - [ Lightweight - PHP ORM Database] ( https://github.com/tamedevelopers/database )
1209+ - [ Support - Library] ( https://github.com/tamedevelopers/support )
12541210- If you love this PHP Library, you can [ Buy Tame Developers a coffee] ( https://www.buymeacoffee.com/tamedevelopers )
12551211- Udemy Course on Usage [ Coming Soon] ( )
0 commit comments