Skip to content

Commit d98f03e

Browse files
committed
added phinx for database & remove in-built migration/seeder
1 parent b4b6803 commit d98f03e

9 files changed

Lines changed: 775 additions & 88 deletions

File tree

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HFX v4
1+
# PHP framework with Phinx
22

33
![Maintainer](https://img.shields.io/badge/maintainer-fadilxcoder-blue) [![Windows](https://svgshare.com/i/ZhY.svg)](https://svgshare.com/i/ZhY.svg)
44

@@ -24,6 +24,19 @@
2424
- Uses node - webpack - compilation of assets
2525
- `public/dist` for compiled assets
2626

27+
---
28+
29+
## Phinx
30+
31+
- Create a migration : `vendor/bin/phinx create UsersMigration`
32+
- Add SQL to created migration
33+
- Migrate data : `vendor/bin/phinx migrate`
34+
- Create newly created seeding : `vendor/bin/phinx seed:create UserSeeder`
35+
- Seed data : `vendor/bin/phinx seed:run`
36+
- `vendor/bin/phinx migrate -t 20220820174815 & vendor/bin/phinx seed:run -s UserSeeder` - Specific migration / seeder
37+
38+
---
39+
2740
### Routing notes
2841

2942
- Documentation on packagist & https://github.com/nikic/FastRoute
@@ -78,6 +91,8 @@
7891

7992
`'/[{extra}]'` : Allowing `<URL>/?fb_click=FB_ID&utm=UTM_ID&gtm=GTM_ID` & `<URL>/`
8093

94+
---
95+
8196
### Routing Regex
8297

8398
- The rules : `'/content/{id:\d+}/{slug:[a-z]+}[/{extra}]'`
@@ -93,7 +108,9 @@
93108
- - `&` *ampersand*
94109
- Finally : `{slug:[a-zA-Z0-9-_&]+}`
95110

96-
## Packages (require / require-dev)
111+
---
112+
113+
## Packages (require / require-dev) / URLs
97114

98115
- https://packagist.org/packages/nikic/fast-route - `Routes`
99116
- https://packagist.org/packages/symfony/http-kernel
@@ -106,12 +123,16 @@
106123
- https://packagist.org/packages/filp/whoops - `Debugger`
107124
- https://packagist.org/packages/fakerphp/faker // https://fakerphp.github.io/ - `Dummy data provider`
108125
- https://packagist.org/packages/mnapoli/silly - `CLI`
126+
- https://book.cakephp.org/phinx/0/en/contents.html - `Phinx Documentation`
127+
128+
---
109129

110130
## Development utilities
111131

112132
- https://picocss.com/ `Minimal CSS Framework for semantic HTML`
113133
- https://picocss.com/examples/preview/ & https://github.com/picocss/examples `Pico examples`
114134

135+
---
115136

116137
## Environment configuration
117138

@@ -124,23 +145,29 @@
124145
</VirtualHost>
125146
```
126147

148+
---
149+
127150
## Usage
128151

129152
- Set up `vhosts`
130153
- Configure `.env`
131154
- `composer install`
132155
- `composer update` when modifying specific **packages** - *PS. `packages/chrome/`, `"version": "master"` in `composer.json`*
133156
- DB tables :
134-
- - `php bin/console database:users up && php bin/console database:users seed` - Create the table `hfx_users` and populate it
135-
- - `php bin/console database:users down` - Drop the table `hfx_users`
157+
- - `vendor/bin/phinx migrate` - Migrate DB
158+
- - `vendor/bin/phinx seed:run` - Popupate DB
159+
- Command : `php bin/console database:users 1 / php bin/console database:users 155` - Fetching data from `users` with specified ID
136160
- Assets `npm install`
137161
- `npm rebuild node-sass` - Changing environment
138162
- Compiling assets
139163
- - `npm run js-build` : compile JS
140164
- - `npm run css-build` : compile CSS
141165
- - `npm run js-build-watch` : compile JS in *watch mode*
142166

143-
## Demo URL
167+
---
168+
169+
## Demo URL for testing
170+
144171
- - http://helifox.local/
145172
- - http://helifox.local/?fb_click=FB_ID&utm=UTM_ID&gtm=GTM_ID
146173
- - http://helifox.local/content/5/fx/?action=cancel

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"nikic/fast-route": "^1.3",
2323
"mnapoli/silly": "^1.7",
2424
"ghost-dvlpr/chrome-php": "dev-master",
25-
"fakerphp/faker": "^1.19"
25+
"fakerphp/faker": "^1.19",
26+
"robmorgan/phinx": "^0.12.12"
2627
},
2728
"require-dev": {
2829
"filp/whoops": "^2.13"

0 commit comments

Comments
 (0)