Skip to content

Commit

Permalink
added phinx for database & remove in-built migration/seeder
Browse files Browse the repository at this point in the history
  • Loading branch information
fadilxcoder committed Aug 20, 2022
1 parent b4b6803 commit d98f03e
Show file tree
Hide file tree
Showing 9 changed files with 775 additions and 88 deletions.
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HFX v4
# PHP framework with Phinx

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

Expand All @@ -24,6 +24,19 @@
- Uses node - webpack - compilation of assets
- `public/dist` for compiled assets

---

## Phinx

- Create a migration : `vendor/bin/phinx create UsersMigration`
- Add SQL to created migration
- Migrate data : `vendor/bin/phinx migrate`
- Create newly created seeding : `vendor/bin/phinx seed:create UserSeeder`
- Seed data : `vendor/bin/phinx seed:run`
- `vendor/bin/phinx migrate -t 20220820174815 & vendor/bin/phinx seed:run -s UserSeeder` - Specific migration / seeder

---

### Routing notes

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

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

---

### Routing Regex

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

## Packages (require / require-dev)
---

## Packages (require / require-dev) / URLs

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

---

## Development utilities

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

---

## Environment configuration

Expand All @@ -124,23 +145,29 @@
</VirtualHost>
```

---

## Usage

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

## Demo URL
---

## Demo URL for testing

- - http://helifox.local/
- - http://helifox.local/?fb_click=FB_ID&utm=UTM_ID&gtm=GTM_ID
- - http://helifox.local/content/5/fx/?action=cancel
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"nikic/fast-route": "^1.3",
"mnapoli/silly": "^1.7",
"ghost-dvlpr/chrome-php": "dev-master",
"fakerphp/faker": "^1.19"
"fakerphp/faker": "^1.19",
"robmorgan/phinx": "^0.12.12"
},
"require-dev": {
"filp/whoops": "^2.13"
Expand Down
Loading

0 comments on commit d98f03e

Please sign in to comment.