42 Commits

Author SHA1 Message Date
54ea22c49a chore: update RoadRunner and PHP versions in Dockerfile (#10)
All checks were successful
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m23s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m14s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m31s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m37s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m27s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m44s
🏗️✨ Build Workflow / 🖥️ 🔨 Build (push) Successful in 10m37s
🏗️✨ Build Workflow / 🖥️ 🔨 Build Migrations (push) Successful in 1m33s
Reviewed-on: #10
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-11-07 04:36:49 +00:00
f8d3462cb7 added example model (#9)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m56s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m47s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m55s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m44s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m8s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m48s
Reviewed-on: #9
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-10-21 17:23:18 +00:00
68614958a9 feat: add migration container and healthchecks for services (#8)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m32s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m31s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m41s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m50s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m40s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m37s
🏗️✨ Build Workflow / 🖥️ 🔨 Build (push) Successful in 12m3s
🏗️✨ Build Workflow / 🖥️ 🔨 Build Migrations (push) Successful in 1m36s
Reviewed-on: #8
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-10-21 14:33:11 +00:00
413145f479 chore: update test configurations and ignore files for coverage reporting (#7)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m47s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m37s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m20s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m21s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m59s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m55s
Reviewed-on: #7
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-10-16 12:44:36 +00:00
d2bd9d2d1b chore/dev-env (#6)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m55s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m56s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m10s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m56s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m45s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 53s
Reviewed-on: #6
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-10-16 00:24:58 +00:00
78d5213892 feat/migrations-container (#5)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m34s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m24s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m38s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m49s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m41s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 56s
🏗️✨ Build Workflow / 🖥️ 🔨 Build (push) Successful in 12m39s
🏗️✨ Build Workflow / 🖥️ 🔨 Build Migrations (push) Successful in 1m35s
Reviewed-on: #5
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-10-15 15:59:17 +00:00
56b78f0102 refactor: update facade structure and add service providers for logging and Redis (#4)
All checks were successful
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m53s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m4s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m7s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m57s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m44s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 52s
🏗️✨ Build Workflow / 🖥️ 🔨 Build (push) Successful in 3m13s
Reviewed-on: #4
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-10-15 15:39:25 +00:00
05d8c5b813 fix-container-build (#3)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m11s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m29s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m27s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m15s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m20s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m26s
Reviewed-on: Siteworxpro/Php-Template#3
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-05-22 18:57:08 -04:00
2d6d0a43f3 The last time I tried this the monkey didn't survive. Let's hope it works better this time. (#2)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 6m44s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 6m53s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m35s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m29s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m39s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 4m3s
Reviewed-on: Siteworxpro/Php-Template#2
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-05-22 13:07:54 -04:00
e203975294 try our sister game minceraft! (#1)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m32s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m30s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m43s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m53s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 3m2s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m8s
Reviewed-on: Siteworxpro/Php-Template#1
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-05-14 12:45:28 -04:00
b1e5470a07 what is estonia up to now ...
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m55s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m56s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m4s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m48s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 3m2s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m5s
2025-05-14 12:04:19 -04:00
5f9ee939d6 Spinning up the hamster...
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m18s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m29s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m44s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m17s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m25s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 3m7s
2025-05-14 11:55:29 -04:00
e9a3a5885f Ok
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m26s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m40s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m17s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m35s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m0s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m38s
2025-05-14 11:50:02 -04:00
f12559d2c3 If it's stupid and it works, it ain't stupid
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m55s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m54s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m0s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m3s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m5s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m12s
2025-05-14 11:47:46 -04:00
b466495ae1 I am Root. We are Root.
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m5s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m46s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m52s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m30s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m6s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m45s
2025-05-14 11:44:22 -04:00
4eb21ace55 Does not work.
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 55s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m25s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m31s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m45s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m59s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 3m21s
2025-05-14 11:42:52 -04:00
a3e54ce989 these confounded tests drive me nuts
Some checks failed
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m2s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m5s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m7s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m10s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m11s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 3m16s
2025-05-14 11:37:15 -04:00
403cb4c12e Never Run This Commit As Root
Some checks failed
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m0s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m59s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m3s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m5s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m7s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Has been cancelled
2025-05-14 11:28:58 -04:00
9f048e408c How is the target directory over 100 gigs?
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m6s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m5s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m11s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m15s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Failing after 2m31s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 57s
2025-05-14 11:22:45 -04:00
be570a3173 eppic fail Mike
Some checks failed
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m14s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m18s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m17s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m29s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m36s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 2m48s
2025-05-14 11:15:40 -04:00
6353a4f19e speling is difikult
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 3m36s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m45s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 4m9s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 7m41s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 7m38s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 7m40s
2025-05-14 11:05:53 -04:00
59bcf4d2a7 Handled a particular error.
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 42s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m27s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m26s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m40s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m21s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m28s
2025-05-14 11:02:48 -04:00
89bc3e75ec It'd be nice if type errors caused the compiler to issue a type error
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m49s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m57s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m2s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m0s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m0s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m59s
2025-05-14 11:00:44 -04:00
fb04e9c390 Never gonna make you cry
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 2m19s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m55s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m51s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m2s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m58s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m3s
2025-05-14 10:53:51 -04:00
77d66abbe0 it is hump day _^_
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m18s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m1s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m1s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m2s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m59s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m5s
2025-05-14 10:52:20 -04:00
52aa7abc2d Landed.
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m51s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m58s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m2s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m1s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m0s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m2s
2025-05-14 10:37:10 -04:00
b6256a7e1d Automate Accounting
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 2m31s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m41s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m50s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m38s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m25s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m31s
2025-05-14 10:32:25 -04:00
59fa57d643 Moved something to somewhere... goodnight...
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m18s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m31s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m30s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m34s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m33s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m44s
2025-05-14 10:29:58 -04:00
199921fb83 Still can't get this right...
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 59s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m5s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m7s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m4s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m4s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m28s
2025-05-14 10:28:10 -04:00
aaf772dc6d apparently i did something…
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m13s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m27s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m24s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m17s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m39s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 3m36s
2025-05-14 10:25:33 -04:00
89fd169067 Never gonna tell a lie and hurt you
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 2m3s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m7s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m9s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m7s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m11s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m11s
2025-05-14 10:22:59 -04:00
a01a0c590b QuickFix.
Some checks failed
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m9s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m13s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m14s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m13s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m15s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 2m27s
2025-05-14 10:19:36 -04:00
dfccf9ca4f --help
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m51s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m3s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m1s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m50s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m11s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m5s
2025-05-14 10:16:47 -04:00
011a1e77c0 Use a real JS construct, WTF knows why this works in chromium.
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 9m49s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 9m47s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 9m52s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 10m17s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 10m25s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 10m30s
2025-05-14 10:06:28 -04:00
7c7b538616 Does this work
Some checks failed
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m2s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 2m6s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m5s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m1s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m5s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m10s
2025-05-14 10:00:22 -04:00
71fa18bc17 bla
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m2s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m58s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m3s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m7s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m5s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m4s
2025-05-14 09:57:56 -04:00
7308f33de4 TDD: 1, Me: 0
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m41s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m3s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m2s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m0s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m23s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m36s
2025-05-14 09:37:47 -04:00
d0d18fd603 Definitely fixing a mistake Copilot made. Totally not mine.
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m21s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m41s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m44s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m45s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m4s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m19s
2025-05-14 09:35:20 -04:00
f57406f981 Popping stash
Some checks failed
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m10s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m15s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m14s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 2m28s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m32s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m33s
2025-05-14 09:31:33 -04:00
e46bf5a6ec All your codebase are belong to us.
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 9m29s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 10m3s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 10m8s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 10m18s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 10m20s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 10m23s
2025-05-14 09:09:41 -04:00
02acc9afbe  - Temporary commit.
All checks were successful
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 6m52s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 6m54s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 7m19s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 7m22s
2025-05-14 07:37:54 -04:00
cdb2b28cb7 removed echo and die statements, lolz.
All checks were successful
🧪✨ Tests Workflow / License Check (push) Successful in 2m1s
🧪✨ Tests Workflow / Code Sniffer (push) Successful in 2m6s
🧪✨ Tests Workflow / Code Lint (push) Successful in 2m11s
🧪✨ Tests Workflow / Unit Tests (push) Successful in 2m49s
2025-05-13 21:32:03 -04:00
41 changed files with 1753 additions and 601 deletions

View File

@@ -1,3 +1,5 @@
.idea/ .idea/
.DS_Store
vendor/ vendor/
.phpunit.cache/ .phpunit.cache/
tests/

View File

@@ -1,7 +1,7 @@
on: on:
create: push:
tags: tags:
- '*' - "v*"
name: 🏗️✨ Build Workflow name: 🏗️✨ Build Workflow
@@ -12,7 +12,6 @@ jobs:
steps: steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates - name: 🛡️ 🔒 Add Siteworx CA Certificates
run: | run: |
apt update && apt install -yq ca-certificates curl
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates update-ca-certificates
@@ -30,9 +29,45 @@ jobs:
- name: 🏗️ 🔧 Set up Docker Buildx - name: 🏗️ 🔧 Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: 🐳 🔨 Build Backend Container - name: 🐳 🔨 Build Container
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64
dockerfile: Dockerfile dockerfile: Dockerfile
tags: siteworxpro/template:${{ gitea.ref_name }} tags: siteworxpro/template:${{ gitea.ref_name }}
Build-Migrations:
needs:
- Build
name: 🖥️ 🔨 Build Migrations
runs-on: ubuntu-latest
steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates
run: |
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates
- name: 🔑 🔐 Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 📖 🔍 Checkout Repository Code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: 🏗️ 🔧 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🐳 🔨 Build Migrations Container
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
sbom: true
provenance: true
context: .
file: migrations.Dockerfile
tags: siteworxpro/template:${{ gitea.ref_name }}-migrations

View File

@@ -1,20 +1,19 @@
on: on:
push: push:
branches: branches:
- "*" - "**"
name: 🧪✨ Tests Workflow name: 🧪✨ Tests Workflow
jobs: jobs:
LicenseCheck: DatabaseMigrations:
name: License Check name: 🧪 ✨ Database Migrations
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates - name: 🛡️ 🔒 Add Siteworx CA Certificates
run: | run: |
apt update && apt install -yq ca-certificates curl
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates update-ca-certificates
@@ -29,15 +28,114 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Install Composer Libraries - name: 🏎️ 🏁 Start Support Containers
run: |
echo "Starting Support Containers"
docker run --rm \
--network "${{ env.JOB_CONTAINER_NAME }}-${{ gitea.job }}-network" \
--name ${{ gitea.job }}-${{ gitea.run_id }}-postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=postgres \
-p 5432 \
-d postgres:17
echo "Waiting for Postgres to start"
sleep 10
- name: 💽 ⬆️ Run Migrations
run: |
docker run \
--name ${{ gitea.run_id }}-migrate \
--rm \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
--network "${{ env.JOB_CONTAINER_NAME }}-${{ gitea.job }}-network" \
-w ${{ github.workspace }} \
siteworxpro/migrate:v4.18.3 -database "postgres://postgres:postgres@${{ gitea.job }}-${{ gitea.run_id }}-postgres:5432/postgres?sslmode=disable" -path db/migrations up
- name: 💽 ⬇️ Rollback Migrations
run: |
docker run \
--name ${{ gitea.run_id }}-migrate \
--rm \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
--network "${{ env.JOB_CONTAINER_NAME }}-${{ gitea.job }}-network" \
-w ${{ github.workspace }} \
siteworxpro/migrate:v4.18.3 -database "postgres://postgres:postgres@${{ gitea.job }}-${{ gitea.run_id }}-postgres:5432/postgres?sslmode=disable" -path db/migrations down --all
- name: 🧨 💥 Tear Down Support Containers
if: always()
run: |
docker stop ${{ gitea.job }}-${{ gitea.run_id }}-postgres
LibraryAudit:
name: 🛡️ 🔒 Library Audit
runs-on: ubuntu-latest
steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates
run: |
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates
- name: 📖 🔍 Checkout Repository Code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: 🔑 🔐 Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 📖 ✨ Install Composer Libraries
run: | run: |
docker run --rm \ docker run --rm \
-v composer-cache:/tmp/cache \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \ --volumes-from ${{ env.JOB_CONTAINER_NAME }} \
-w ${{ github.workspace }} \ -w ${{ github.workspace }} \
siteworxpro/composer \ siteworxpro/composer \
install --ignore-platform-reqs --no-interaction --prefer-dist --optimize-autoloader install --ignore-platform-reqs --no-interaction --prefer-dist --optimize-autoloader
- name: Run License Check - name: Run Library Audit
run: |
docker run --rm \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
-w ${{ github.workspace }} \
siteworxpro/composer \
audit
LicenseCheck:
name: 🛡️ 🔒 License Check
runs-on: ubuntu-latest
steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates
run: |
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates
- name: 📖 🔍 Checkout Repository Code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: 🔑 🔐 Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 📖 ✨ Install Composer Libraries
run: |
docker run --rm \
-v composer-cache:/tmp/cache \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
-w ${{ github.workspace }} \
siteworxpro/composer \
install --ignore-platform-reqs --no-interaction --prefer-dist --optimize-autoloader
- name: 🎟️ 🔬 Run License Check
run: | run: |
docker run --rm \ docker run --rm \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \ --volumes-from ${{ env.JOB_CONTAINER_NAME }} \
@@ -46,12 +144,11 @@ jobs:
run tests:license run tests:license
CodeLint: CodeLint:
name: Code Lint name: 📝 ✨ Code Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates - name: 🛡️ 🔒 Add Siteworx CA Certificates
run: | run: |
apt update && apt install -yq ca-certificates curl
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates update-ca-certificates
@@ -66,9 +163,10 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Install Composer Libraries - name: 📖 ✨ Install Composer Libraries
run: | run: |
docker run --rm \ docker run --rm \
-v composer-cache:/tmp/cache \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \ --volumes-from ${{ env.JOB_CONTAINER_NAME }} \
-w ${{ github.workspace }} \ -w ${{ github.workspace }} \
siteworxpro/composer \ siteworxpro/composer \
@@ -83,12 +181,11 @@ jobs:
run tests:lint run tests:lint
CodeSniffer: CodeSniffer:
name: Code Sniffer name: 🐙 🔍 Code Sniffer
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates - name: 🛡️ 🔒 Add Siteworx CA Certificates
run: | run: |
apt update && apt install -yq ca-certificates curl
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates update-ca-certificates
@@ -103,9 +200,10 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Install Composer Libraries - name: 📖 ✨ Install Composer Libraries
run: | run: |
docker run --rm \ docker run --rm \
-v composer-cache:/tmp/cache \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \ --volumes-from ${{ env.JOB_CONTAINER_NAME }} \
-w ${{ github.workspace }} \ -w ${{ github.workspace }} \
siteworxpro/composer \ siteworxpro/composer \
@@ -120,12 +218,11 @@ jobs:
run tests:phpstan run tests:phpstan
UnitTests: UnitTests:
name: Unit Tests name: 🧪 ✅ Unit Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates - name: 🛡️ 🔒 Add Siteworx CA Certificates
run: | run: |
apt update && apt install -yq ca-certificates curl
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates update-ca-certificates
@@ -140,18 +237,32 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Install Composer Libraries - name: 📖 ✨ Install Composer Libraries
run: | run: |
docker run --rm \ docker run --rm \
-v composer-cache:/tmp/cache \
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \ --volumes-from ${{ env.JOB_CONTAINER_NAME }} \
-w ${{ github.workspace }} \ -w ${{ github.workspace }} \
siteworxpro/composer \ siteworxpro/composer \
install --ignore-platform-reqs --no-interaction --prefer-dist --optimize-autoloader install --ignore-platform-reqs --no-interaction --prefer-dist --optimize-autoloader
- name: Run Unit Tests - name: 🧪 ✅ Run Unit Tests
uses: addnab/docker-run-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
image: siteworxpro/composer
options: --volumes-from ${{ env.JOB_CONTAINER_NAME }} -w ${{ gitea.workspace }}
run: | run: |
docker run --rm \ bin/pcov.sh
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \ composer run tests:unit:coverage
-w ${{ github.workspace }} \
siteworxpro/composer \ # - name: 📦 Publish Build Artifacts
run tests:unit # env:
# NODE_TLS_REJECT_UNAUTHORIZED: 0
# uses: christopherhx/gitea-upload-artifact@v4
# with:
# options: --volumes-from ${{ env.JOB_CONTAINER_NAME }} -w ${{ gitea.workspace }}
# name: junit-coverage.xml
# path: tests/reports/junit.xml
# retention-days: 1

3
.gitignore vendored
View File

@@ -1,3 +1,6 @@
.idea/ .idea/
.DS_Store
vendor/ vendor/
.phpunit.cache/ .phpunit.cache/
tests/reports/

View File

@@ -1,5 +0,0 @@
include:
- local: .gitlab/ci/stages.yml
- local: .gitlab/ci/tests.yml
- local: .gitlab/ci/libraries.yml

View File

@@ -1,15 +0,0 @@
Install Composer Libraries:
stage: libraries
image: siteworxpro/composer:latest
rules:
- if: '$CI_COMMIT_TAG'
when: never
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
- when: never
script:
- composer install --ignore-platform-reqs
artifacts:
paths:
- vendor/
expire_in: 1 hour

View File

@@ -1,3 +0,0 @@
stages:
- libraries
- tests

View File

@@ -1,65 +0,0 @@
Unit Tests:
stage: tests
needs:
- Install Composer Libraries
rules:
- if: '$CI_COMMIT_TAG'
when: never
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
- when: never
image: siteworxpro/composer
before_script: |
bin/pcov.sh
script: |
echo "Running unit tests..."
composer run tests:unit:coverage
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
artifacts:
expire_in: 1 day
reports:
junit: tests/reports/junit.xml
paths:
- tests/reports/
Run License Check:
stage: tests
needs:
- Install Composer Libraries
rules:
- if: '$CI_COMMIT_TAG'
when: never
- if: '$CI_PIPELINE_SOURCE == "push"'
when: on_success
- when: never
image: siteworxpro/composer
script:
- composer run tests:license
Run Code Lint:
stage: tests
needs:
- Install Composer Libraries
rules:
- if: '$CI_COMMIT_TAG'
when: never
- if: '$CI_PIPELINE_SOURCE == "push"'
when: on_success
- when: never
image: siteworxpro/composer
script:
- composer run tests:lint
Run Code Sniffer:
stage: tests
needs:
- Install Composer Libraries
rules:
- if: '$CI_COMMIT_TAG'
when: never
- if: '$CI_PIPELINE_SOURCE == "push"'
when: on_success
- when: never
image: siteworxpro/composer
script:
- composer run tests:phpstan

View File

@@ -1,5 +1,5 @@
# Use the RoadRunner image as a base for the first stage # Use the RoadRunner image as a base for the first stage
FROM ghcr.io/roadrunner-server/roadrunner:2025.1.1 AS roadrunner FROM ghcr.io/roadrunner-server/roadrunner:2025.1.4 AS roadrunner
# Use the official Composer image as the base for the library stage # Use the official Composer image as the base for the library stage
FROM siteworxpro/composer AS library FROM siteworxpro/composer AS library
@@ -12,7 +12,7 @@ RUN composer install --optimize-autoloader --ignore-platform-reqs --no-dev
# Use the official PHP CLI image with Alpine Linux for the second stage # Use the official PHP CLI image with Alpine Linux for the second stage
FROM php:8.4.6-alpine AS php FROM php:8.4.14-alpine AS php
# Move the production PHP configuration file to the default location # Move the production PHP configuration file to the default location
RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini \ RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini \
@@ -33,6 +33,7 @@ COPY --from=library /app/vendor /app/vendor
ADD src src/ ADD src src/
ADD server.php . ADD server.php .
ADD .rr.yaml . ADD .rr.yaml .
ADD config.php .
EXPOSE 9501 EXPOSE 9501

View File

@@ -1,8 +1,6 @@
# Template # Template
[![pipeline status](https://git.siteworxpro.com/rrise/php-template/badges/master/pipeline.svg)](https://git.siteworxpro.com/rrise/php-template/-/commits/master) ![pipeline status](https://gitea.siteworxpro.com/siteworxpro/Php-Template/actions/workflows/tests.yml/badge.svg?branch=master&style=flat-square)
[![coverage report](https://git.siteworxpro.com/rrise/php-template/badges/master/coverage.svg)](https://git.siteworxpro.com/rrise/php-template/-/commits/master)
[![Latest Release](https://git.siteworxpro.com/rrise/php-template/-/badges/release.svg)](https://git.siteworxpro.com/rrise/php-template/-/releases)
## Dev Environment ## Dev Environment
@@ -10,13 +8,28 @@
- Docker - Docker
- Docker Compose - Docker Compose
### migrations
create a new migration
```shell
docker run --rm -v $(PWD):/app siteworxpro/migrate:v4.18.3 create -ext sql -dir /app/db/migrations -seq create_users_table
```
```text
postgres://siteworxpro:password@localhost:5432/siteworxpro?sslmode=disable
```
```shell
docker run --rm -v $(PWD):/app siteworxpro/migrate:v4.18.3 -database "postgres://siteworxpro:password@localhost:5432/siteworxpro?sslmode=disable" -path /app/db/migrations up
```
### Starting the Runtime ### Starting the Runtime
```shell ```shell
docker-compose up -d docker-compose up -d
``` ```
### Start the server ### Start the server
```shell ```shell
docker exec -it template-runtime-1 rr serve docker exec -it template-dev-runtime-1 rr serve
``` ```
You can access the api at `http://localhost:9501/` You can access the api at `http://localhost:9501/`
@@ -25,7 +38,7 @@ You can access the api at `http://localhost:9501/`
xdebug needs to be built into the container before it will work xdebug needs to be built into the container before it will work
```shell ```shell
docker exec -it template-runtime-1 bin/xdebug.sh docker exec -it php-template-composer-runtime-1 bin/xdebug.sh
``` ```
### Install the dependencies ### Install the dependencies

4
bin/migrate.sh Executable file
View File

@@ -0,0 +1,4 @@
eval #!/bin/sh
set -e
migrate -path /app/db/migrations -database "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_DATABASE?sslmode=disable" up

View File

@@ -9,21 +9,21 @@
}, },
"require": { "require": {
"php": "^8.4", "php": "^8.4",
"league/route": "^6.2", "league/route": "^6.2.0",
"illuminate/database": "^12.10", "illuminate/database": "^v12.34.0",
"spiral/roadrunner-http": "^3.5", "spiral/roadrunner-http": "^v3.6.0",
"nyholm/psr7": "^1.8", "nyholm/psr7": "^1.8.2",
"illuminate/support": "^v12.10.2", "illuminate/support": "^v12.10.2",
"roadrunner-php/app-logger": "^1.2", "roadrunner-php/app-logger": "^1.2.0",
"siteworxpro/config": "^1.1", "siteworxpro/config": "^1.1.1",
"predis/predis": "^3.0" "predis/predis": "^v3.2.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^12.1", "phpunit/phpunit": "^12.4",
"mockery/mockery": "^1.6", "mockery/mockery": "^1.6",
"squizlabs/php_codesniffer": "^3.12", "squizlabs/php_codesniffer": "^3.12",
"lendable/composer-license-checker": "^1.2", "lendable/composer-license-checker": "^1.2",
"phpstan/phpstan": "^2.1" "phpstan/phpstan": "^2.1.31"
}, },
"scripts": { "scripts": {
"tests:all": [ "tests:all": [
@@ -53,16 +53,10 @@
"phpstan analyse --level 4 ./src/ -c phpstan.neon" "phpstan analyse --level 4 ./src/ -c phpstan.neon"
] ]
}, },
"repositories": { "repositories": [
"git.siteworxpro.com/24": { {
"type": "composer", "type": "composer",
"url": "https://git.siteworxpro.com/api/v4/group/24/-/packages/composer/packages.json", "url": "https://gitea.siteworxpro.com/api/packages/php-packages/composer"
"options": {
"ssl": {
"verify_peer": false,
"allow_self_signed": true
}
}
}
} }
]
} }

954
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -21,8 +21,14 @@ return [
'database' => Env::get('DB_DATABASE', 'siteworxpro'), 'database' => Env::get('DB_DATABASE', 'siteworxpro'),
'username' => Env::get('DB_USERNAME', 'siteworxpro'), 'username' => Env::get('DB_USERNAME', 'siteworxpro'),
'password' => Env::get('DB_PASSWORD', 'password'), 'password' => Env::get('DB_PASSWORD', 'password'),
'port' => Env::get('DB_PORT', 5432, 'int'),
'charset' => Env::get('DB_CHARSET', 'utf8'),
'collation' => Env::get('DB_COLLATION', 'utf8_unicode_ci'),
'prefix' => Env::get('DB_PREFIX', ''),
'options' => [
// Add any additional PDO options here
],
], ],
'cors' => [ 'cors' => [
'allowed_origins' => Env::get('CORS_ALLOWED_ORIGINS', 'localhost:3000'), 'allowed_origins' => Env::get('CORS_ALLOWED_ORIGINS', 'localhost:3000'),
@@ -34,5 +40,6 @@ return [
'host' => Env::get('REDIS_HOST', 'localhost'), 'host' => Env::get('REDIS_HOST', 'localhost'),
'port' => Env::get('REDIS_PORT', 6379, 'int'), 'port' => Env::get('REDIS_PORT', 6379, 'int'),
'database' => Env::get('REDIS_DATABASE', 0, 'int'), 'database' => Env::get('REDIS_DATABASE', 0, 'int'),
'password' => Env::get('REDIS_PASSWORD'),
] ]
]; ];

View File

@@ -12,6 +12,24 @@ services:
environment: environment:
PHP_IDE_CONFIG: serverName=localhost PHP_IDE_CONFIG: serverName=localhost
migration-container:
volumes:
- ./db/migrations:/app/db/migrations
- ./bin:/app/bin
image: siteworxpro/migrate:v4.18.3
working_dir: /app
# entrypoint: "/bin/sh -c 'while true; do sleep 30; done;'"
entrypoint: /bin/sh -c '/app/bin/migrate.sh'
depends_on:
postgres:
condition: service_healthy
environment:
DB_USERNAME: ${DB_USERNAME:-siteworxpro}
DB_PASSWORD: ${DB_PASSWORD:-password}
DB_DATABASE: ${DB_DATABASE:-siteworxpro}
DB_HOST: ${DB_HOST-postgres}
DB_PORT: ${DB_PORT-5432}
dev-runtime: dev-runtime:
ports: ports:
- "9501:9501" - "9501:9501"
@@ -29,6 +47,11 @@ services:
redis: redis:
image: redis:latest image: redis:latest
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
ports: ports:
- "6379:6379" - "6379:6379"
volumes: volumes:
@@ -36,6 +59,11 @@ services:
postgres: postgres:
image: postgres:latest image: postgres:latest
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-siteworxpro}"]
interval: 10s
timeout: 5s
retries: 5
environment: environment:
POSTGRES_USER: ${DB_USERNAME:-siteworxpro} POSTGRES_USER: ${DB_USERNAME:-siteworxpro}
POSTGRES_PASSWORD: ${DB_PASSWORD:-password} POSTGRES_PASSWORD: ${DB_PASSWORD:-password}

8
migrations.Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM siteworxpro/migrate:v4.18.3
ADD db/migrations /app/db/migrations
ADD bin/migrate.sh /app/bin/migrate.sh
WORKDIR /app
ENTRYPOINT ["/app/bin/migrate.sh"]

View File

@@ -4,11 +4,11 @@ use Siteworxpro\App\Server;
require __DIR__ . '/vendor/autoload.php'; require __DIR__ . '/vendor/autoload.php';
try {
// Instantiate the ExternalServer class // Instantiate the ExternalServer class
$server = new Server(); $server = new Server();
// Start the server // Start the server
try {
$server->startServer(); $server->startServer();
} catch (JsonException $e) { } catch (JsonException $e) {
echo $e->getMessage(); echo $e->getMessage();

View File

@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Controllers;
use League\Route\Http\Exception\NotFoundException;
use Nyholm\Psr7\ServerRequest;
use Psr\Http\Message\ResponseInterface;
abstract class Controller implements ControllerInterface
{
/**
* @param ServerRequest $request
* @return ResponseInterface
* @throws NotFoundException
*/
public function get(ServerRequest $request): ResponseInterface
{
throw new NotFoundException("not found");
}
/**
* @throws NotFoundException
*/
public function post(ServerRequest $request): ResponseInterface
{
throw new NotFoundException("not found");
}
/**
* @throws NotFoundException
*/
public function put(ServerRequest $request): ResponseInterface
{
throw new NotFoundException("not found");
}
/**
* @throws NotFoundException
*/
public function delete(ServerRequest $request): ResponseInterface
{
throw new NotFoundException("not found");
}
/**
* @throws NotFoundException
*/
public function patch(ServerRequest $request): ResponseInterface
{
throw new NotFoundException("not found");
}
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Controllers;
use Nyholm\Psr7\ServerRequest;
use Psr\Http\Message\ResponseInterface;
interface ControllerInterface
{
/**
* Handle the request and return a response.
*
* @param ServerRequest $request The request data.
* @return ResponseInterface The response data.
*/
public function get(ServerRequest $request): ResponseInterface;
/**
* Handle the request and return a response.
*
* @param ServerRequest $request The request data.
* @return ResponseInterface The response data.
*/
public function post(ServerRequest $request): ResponseInterface;
/**
* Handle the request and return a response.
*
* @param ServerRequest $request The request data.
* @return ResponseInterface The response data.
*/
public function put(ServerRequest $request): ResponseInterface;
/**
* Handle the request and return a response.
*
* @param ServerRequest $request The request data.
* @return ResponseInterface The response data.
*/
public function delete(ServerRequest $request): ResponseInterface;
/**
* Handle the request and return a response.
*
* @param ServerRequest $request The request data.
* @return ResponseInterface The response data.
*/
public function patch(ServerRequest $request): ResponseInterface;
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Controllers;
use Nyholm\Psr7\ServerRequest;
use Psr\Http\Message\ResponseInterface;
use Siteworxpro\App\Http\JsonResponseFactory;
/**
* Class IndexController
*
* This class handles the index route of the application.
*/
class IndexController extends Controller
{
/**
* Handles the GET request for the index route.
*
* @throws \JsonException
*/
public function get(ServerRequest $request): ResponseInterface
{
return JsonResponseFactory::createJsonResponse(['status_code' => 200, 'message' => 'Server is running']);
}
}

View File

@@ -1,57 +0,0 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Facades;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Support\Facades\Facade;
use Siteworx\Config\Exception\EmptyDirectoryException;
use Siteworx\Config\Exception\FileNotFoundException;
use Siteworx\Config\Exception\UnsupportedFormatException;
/**
* Class Config
*
* This class serves as a facade for the configuration settings of the application.
* It extends the Facade class from the Illuminate\Support\Facades namespace.
*
* @method static bool | string | int get(string $key) Retrieve the configuration value for the given key.
*
* @package Siteworx\App\Facades
*/
class Config extends Facade
{
protected static $cached = false;
/**
* @throws UnsupportedFormatException
* @throws FileNotFoundException
* @throws EmptyDirectoryException
*/
public static function getFacadeRoot(): \Siteworx\Config\Config
{
if (self::$resolvedInstance !== null) {
try {
$config = self::resolveFacadeInstance(self::getFacadeAccessor());
if ($config instanceof \Siteworx\Config\Config) {
return $config;
}
} catch (BindingResolutionException) {
}
}
return \Siteworx\Config\Config::load(__DIR__ . '/../../config.php');
}
/**
* Get the registered name of the component.
*
* @return string The name of the component.
*/
protected static function getFacadeAccessor(): string
{
return \Siteworx\Config\Config::class;
}
}

View File

@@ -9,7 +9,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Siteworxpro\App\Facades\Config; use Siteworxpro\App\Services\Facades\Config;
/** /**
* Class CorsMiddleware * Class CorsMiddleware

View File

@@ -6,6 +6,12 @@ namespace Siteworxpro\App\Models;
use Illuminate\Database\Eloquent\Model as ORM; use Illuminate\Database\Eloquent\Model as ORM;
/**
* Class Model
*
* @package Siteworxpro\App\Models
*/
abstract class Model extends ORM abstract class Model extends ORM
{ {
protected $dateFormat = 'Y-m-d H:i:s';
} }

52
src/Models/User.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Models;
use Carbon\Carbon;
/**
* Class User
*
* @property string $id
* @property string $first_name
* @property string $last_name
* @property string $email
* @property string $password
* @property Carbon $created_at
*
* @property-read string $full_name
* @property-read string $formatted_email
*/
class User extends Model
{
protected $casts = [
'created_at' => 'datetime',
];
protected $hidden = [
'password',
];
protected $fillable = [
'first_name',
'last_name',
'email',
'password',
];
public function getFullNameAttribute(): string
{
return "$this->first_name $this->last_name";
}
public function getFormattedEmailAttribute(): string
{
return sprintf(
'%s <%s>',
$this->getFullNameAttribute(),
strtolower($this->email)
);
}
}

View File

@@ -5,15 +5,21 @@ declare(strict_types=1);
namespace Siteworxpro\App; namespace Siteworxpro\App;
use Illuminate\Container\Container; use Illuminate\Container\Container;
use Illuminate\Support\Facades\Facade; use Illuminate\Database\Capsule\Manager;
use Illuminate\Support\ServiceProvider;
use League\Route\Http\Exception\MethodNotAllowedException; use League\Route\Http\Exception\MethodNotAllowedException;
use League\Route\Http\Exception\NotFoundException; use League\Route\Http\Exception\NotFoundException;
use League\Route\Router; use League\Route\Router;
use Nyholm\Psr7\Factory\Psr17Factory; use Nyholm\Psr7\Factory\Psr17Factory;
use Siteworxpro\App\Facades\Config; use Siteworx\Config\Config as SWConfig;
use Siteworxpro\App\Facades\Logger; use Siteworxpro\App\Controllers\IndexController;
use Siteworxpro\App\Http\JsonResponseFactory; use Siteworxpro\App\Http\JsonResponseFactory;
use Siteworxpro\App\Http\Middleware\CorsMiddleware; use Siteworxpro\App\Http\Middleware\CorsMiddleware;
use Siteworxpro\App\Services\Facade;
use Siteworxpro\App\Services\Facades\Config;
use Siteworxpro\App\Services\Facades\Logger;
use Siteworxpro\App\Services\ServiceProviders\LoggerServiceProvider;
use Siteworxpro\App\Services\ServiceProviders\RedisServiceProvider;
use Spiral\RoadRunner\Http\PSR7Worker; use Spiral\RoadRunner\Http\PSR7Worker;
use Spiral\RoadRunner\Worker; use Spiral\RoadRunner\Worker;
@@ -38,11 +44,17 @@ class Server
*/ */
protected PSR7Worker $worker; protected PSR7Worker $worker;
public static array $serviceProviders = [
LoggerServiceProvider::class,
RedisServiceProvider::class
];
/** /**
* Server constructor. * Server constructor.
* *
* Initializes the server by booting the PSR-7 worker and router. * Initializes the server by booting the PSR-7 worker and router.
* @throws \ReflectionException
*/ */
public function __construct() public function __construct()
{ {
@@ -57,11 +69,33 @@ class Server
* subclasses to ensure proper initialization. * subclasses to ensure proper initialization.
* *
* @return void * @return void
* @throws \ReflectionException
*/ */
private function boot(): void private function boot(): void
{ {
$container = new Container(); $container = new Container();
Facade::setFacadeApplication($container); Facade::setFacadeContainer($container);
// Bind the container to the Config facade first so that it can be used by service providers
$container->bind(SWConfig::class, function () {
return SWConfig::load(__DIR__ . '/../config.php');
});
foreach (self::$serviceProviders as $serviceProvider) {
if (class_exists($serviceProvider)) {
$provider = new $serviceProvider($container);
if ($provider instanceof ServiceProvider) {
$provider->register();
} else {
throw new \RuntimeException(sprintf(
'Service provider %s is not an instance of ServiceProvider.',
$serviceProvider
));
}
} else {
throw new \RuntimeException(sprintf('Service provider %s not found.', $serviceProvider));
}
}
$this->worker = new PSR7Worker( $this->worker = new PSR7Worker(
Worker::create(), Worker::create(),
@@ -87,18 +121,8 @@ class Server
*/ */
public function bootModelCapsule(): void public function bootModelCapsule(): void
{ {
$capsule = new \Illuminate\Database\Capsule\Manager(); $capsule = new Manager();
$capsule->addConnection([ $capsule->addConnection(Config::get('db'));
'driver' => Config::get('db.driver'),
'host' => Config::get('db.host'),
'database' => Config::get('db.database'),
'username' => Config::get('db.username'),
'password' => Config::get('db.password'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
]);
$capsule->setAsGlobal(); $capsule->setAsGlobal();
$capsule->bootEloquent(); $capsule->bootEloquent();
} }
@@ -113,10 +137,7 @@ class Server
*/ */
protected function registerRoutes(): void protected function registerRoutes(): void
{ {
$this->router->get('/', function () { $this->router->get('/', IndexController::class . '::get');
return JsonResponseFactory::createJsonResponse(['status_code' => 200, 'message' => 'Server is running']);
});
$this->router->middleware(new CorsMiddleware()); $this->router->middleware(new CorsMiddleware());
} }

308
src/Services/Facade.php Normal file
View File

@@ -0,0 +1,308 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Services;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\Testing\Fakes\Fake;
use Mockery;
use Mockery\Expectation;
use Mockery\ExpectationInterface;
use Mockery\LegacyMockInterface;
use Mockery\MockInterface;
class Facade
{
/**
* The application instance being facaded.
*
* @var Container | null
*/
protected static ?Container $container = null;
/**
* The resolved object instances.
*
* @var array
*/
protected static array $resolvedInstance;
/**
* Indicates if the resolved instance should be cached.
*
* @var bool
*/
protected static bool $cached = true;
/**
* Run a Closure when the facade has been resolved.
*
* @param \Closure $callback
* @return void
*/
public static function resolved(\Closure $callback): void
{
$accessor = static::getFacadeAccessor();
if (static::$container->resolved($accessor) === true) {
$callback(static::getFacadeRoot(), static::$container);
}
static::$container->afterResolving($accessor, function ($service, $app) use ($callback) {
$callback($service, $app);
});
}
/**
* Convert the facade into a Mockery spy.
*
* @return MockInterface
*/
public static function spy(): MockInterface
{
if (! static::isMock()) {
$class = static::getMockableClass();
return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) {
static::swap($spy);
});
}
throw new \RuntimeException('Cannot spy on an existing mock instance.');
}
/**
* Initiate a partial mock on the facade.
*
* @return MockInterface
*/
public static function partialMock(): MockInterface
{
$name = static::getFacadeAccessor();
$mock = static::isMock()
? static::$resolvedInstance[$name]
: static::createFreshMockInstance();
return $mock->makePartial();
}
/**
* Initiate a mock expectation on the facade.
*
* @return Expectation|ExpectationInterface
*/
public static function shouldReceive(): Mockery\Expectation | Mockery\ExpectationInterface
{
$name = static::getFacadeAccessor();
$mock = static::isMock()
? static::$resolvedInstance[$name]
: static::createFreshMockInstance();
return $mock->shouldReceive(...func_get_args());
}
/**
* Initiate a mock expectation on the facade.
*
* @return Expectation|ExpectationInterface
*/
public static function expects(): Mockery\Expectation | Mockery\ExpectationInterface
{
$name = static::getFacadeAccessor();
$mock = static::isMock()
? static::$resolvedInstance[$name]
: static::createFreshMockInstance();
return $mock->expects(...func_get_args());
}
/**
* Create a fresh mock instance for the given class.
*
* @return MockInterface|LegacyMockInterface
*/
protected static function createFreshMockInstance(): MockInterface | LegacyMockInterface
{
return tap(static::createMock(), function ($mock) {
static::swap($mock);
$mock->shouldAllowMockingProtectedMethods();
});
}
/**
* Create a fresh mock instance for the given class.
*
* @return MockInterface
*/
protected static function createMock(): MockInterface
{
$class = static::getMockableClass();
return $class ? Mockery::mock($class) : Mockery::mock();
}
/**
* Determines whether a mock is set as the instance of the facade.
*
* @return bool
*/
protected static function isMock(): bool
{
$name = static::getFacadeAccessor();
return isset(static::$resolvedInstance[$name]) &&
static::$resolvedInstance[$name] instanceof LegacyMockInterface;
}
/**
* Get the mockable class for the bound instance.
*
* @return string|null
*/
protected static function getMockableClass(): ?string
{
if ($root = static::getFacadeRoot()) {
return get_class($root);
}
return null;
}
/**
* Hotswap the underlying instance behind the facade.
*
* @param mixed $instance
* @return void
*/
public static function swap(mixed $instance): void
{
static::$resolvedInstance[static::getFacadeAccessor()] = $instance;
if (isset(static::$container)) {
static::$container->instance(static::getFacadeAccessor(), $instance);
}
}
/**
* Determines whether a "fake" has been set as the facade instance.
*
* @return bool
*/
public static function isFake(): bool
{
$name = static::getFacadeAccessor();
return isset(static::$resolvedInstance[$name]) &&
static::$resolvedInstance[$name] instanceof Fake;
}
/**
* Get the root object behind the facade.
*
* @return mixed
*/
public static function getFacadeRoot(): mixed
{
return static::resolveFacadeInstance(static::getFacadeAccessor());
}
/**
* Get the registered name of the component.
*
* @return string
*
* @throws \RuntimeException
*/
protected static function getFacadeAccessor(): string
{
throw new \RuntimeException('Facade does not implement getFacadeAccessor method.');
}
/**
* Resolve the facade root instance from the container.
*
* @param string $name
* @return mixed
*/
protected static function resolveFacadeInstance(string $name): mixed
{
if (isset(static::$resolvedInstance[$name])) {
return static::$resolvedInstance[$name];
}
if (static::$container) {
if (static::$cached) {
return static::$resolvedInstance[$name] = static::$container[$name];
}
return static::$container[$name];
}
return null;
}
/**
* Clear a resolved facade instance.
*
* @param string $name
* @return void
*/
public static function clearResolvedInstance(string $name): void
{
unset(static::$resolvedInstance[$name]);
}
/**
* Clear all of the resolved instances.
*
* @return void
*/
public static function clearResolvedInstances(): void
{
static::$resolvedInstance = [];
}
/**
* Get the application instance behind the facade.
*/
public static function getFacadeContainer(): ?Container
{
return static::$container;
}
/**
* Set the application instance.
*
* @param Container | null $container
* @return void
*/
public static function setFacadeContainer(Container | null $container): void
{
static::$container = $container;
}
/**
* Handle dynamic, static calls to the object.
*
* @param string $method
* @param array $args
* @return mixed
*
* @throws \RuntimeException
*/
public static function __callStatic(string $method, array $args)
{
$instance = static::getFacadeRoot();
if (! $instance) {
throw new \RuntimeException('A facade root has not been set.');
}
return $instance->$method(...$args);
}
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Services\Facades;
use Siteworx\Config\Config as SwConfig;
use Siteworxpro\App\Services\Facade;
/**
* Class Config
*
* This class serves as a facade for the configuration settings of the application.
* It extends the Facade class from the Illuminate\Support\Facades namespace.
*
* @method static array | bool | string | int | null get(string $key) Retrieve the configuration value for the given key. // @codingStandardsIgnoreStart
*
* @package Siteworx\App\Facades
*/
class Config extends Facade
{
/**
* Get the registered name of the component.
*
* @return string The name of the component.
*/
protected static function getFacadeAccessor(): string
{
return SwConfig::class;
}
}

View File

@@ -2,11 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Siteworxpro\App\Facades; namespace Siteworxpro\App\Services\Facades;
use Illuminate\Support\Facades\Facade;
use RoadRunner\Logger\Logger as RRLogger; use RoadRunner\Logger\Logger as RRLogger;
use Spiral\Goridge\RPC\RPC; use Siteworxpro\App\Services\Facade;
/** /**
* Class Logger * Class Logger
@@ -14,6 +13,7 @@ use Spiral\Goridge\RPC\RPC;
* This class serves as a facade for the Monolog logger. * This class serves as a facade for the Monolog logger.
* It extends the Facade class from the Illuminate\Support\Facades namespace. * It extends the Facade class from the Illuminate\Support\Facades namespace.
* *
* @method static debug(string $message, array $context = []) Log an informational message.
* @method static info(string $message, array $context = []) Log an informational message. * @method static info(string $message, array $context = []) Log an informational message.
* @method static error(string $message, array $context = []) Log an error message. * @method static error(string $message, array $context = []) Log an error message.
* @method static warning(string $message, array $context = []) Log a warning message. * @method static warning(string $message, array $context = []) Log a warning message.
@@ -22,22 +22,6 @@ use Spiral\Goridge\RPC\RPC;
*/ */
class Logger extends Facade class Logger extends Facade
{ {
public static function getFacadeRoot(): RRLogger
{
if (self::$resolvedInstance !== null) {
$logger = self::resolveFacadeInstance(self::getFacadeAccessor());
if ($logger instanceof RRLogger) {
return $logger;
}
}
$rpc = RPC::create('tcp://127.0.0.1:6001');
return new RRLogger($rpc);
}
/** /**
* Get the registered name of the component. * Get the registered name of the component.
* *

View File

@@ -2,11 +2,11 @@
declare(strict_types=1); declare(strict_types=1);
namespace Siteworxpro\App\Facades; namespace Siteworxpro\App\Services\Facades;
use Illuminate\Support\Facades\Facade;
use Predis\Client; use Predis\Client;
use Predis\Response\Status; use Predis\Response\Status;
use Siteworxpro\App\Services\Facade;
/** /**
* Facade for the Redis client. * Facade for the Redis client.
@@ -21,25 +21,6 @@ use Predis\Response\Status;
*/ */
class Redis extends Facade class Redis extends Facade
{ {
public static function getFacadeRoot(): Client
{
if (self::$resolvedInstance !== null) {
$redis = self::resolveFacadeInstance(self::getFacadeAccessor());
if ($redis instanceof Client) {
return $redis;
}
}
// Create a new Redis client instance if not already resolved
return new Client([
'scheme' => 'tcp',
'host' => Config::get('redis.host'),
'port' => Config::get('redis.port'),
'database' => Config::get('redis.database'),
]);
}
/** /**
* Get the registered name of the component. * Get the registered name of the component.
* *

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Services\ServiceProviders;
use Illuminate\Support\ServiceProvider;
use RoadRunner\Logger\Logger as RRLogger;
use Spiral\Goridge\RPC\RPC;
class LoggerServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton(RRLogger::class, function () {
$rpc = RPC::create('tcp://127.0.0.1:6001');
return new RRLogger($rpc);
});
}
}

View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Services\ServiceProviders;
use Illuminate\Support\ServiceProvider;
use Predis\Client;
use Siteworxpro\App\Services\Facades\Config;
class RedisServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton(Client::class, function () {
return new Client([
'scheme' => 'tcp',
'host' => Config::get('redis.host'),
'port' => Config::get('redis.port'),
'database' => Config::get('redis.database'),
'password' => Config::get('redis.password'),
]);
});
}
}

View File

@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\Controllers;
use Nyholm\Psr7\ServerRequest;
use Siteworxpro\Tests\Unit;
abstract class AbstractController extends Unit
{
protected function getMockRequest(string $method = 'GET', string $uri = '/'): ServerRequest
{
return new ServerRequest($method, $uri);
}
}

View File

@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\Controllers;
use Siteworxpro\App\Controllers\Controller;
class ControllerTest extends AbstractController
{
public function testNotFoundExceptions()
{
$testClass = new TestClass();
$this->expectException(\League\Route\Http\Exception\NotFoundException::class);
$testClass->get($this->getMockRequest());
}
public function testNotFoundExceptionPost()
{
$testClass = new TestClass();
$this->expectException(\League\Route\Http\Exception\NotFoundException::class);
$testClass->post($this->getMockRequest());
}
public function testNotFoundExceptionPut()
{
$testClass = new TestClass();
$this->expectException(\League\Route\Http\Exception\NotFoundException::class);
$testClass->put($this->getMockRequest());
}
public function testNotFoundExceptionDelete()
{
$testClass = new TestClass();
$this->expectException(\League\Route\Http\Exception\NotFoundException::class);
$testClass->delete($this->getMockRequest());
}
public function testNotFoundExceptionPatch()
{
$testClass = new TestClass();
$this->expectException(\League\Route\Http\Exception\NotFoundException::class);
$testClass->patch($this->getMockRequest());
}
}
class TestClass extends Controller // phpcs:ignore
{
}

View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\Controllers;
use Siteworxpro\App\Controllers\IndexController;
class IndexControllerTest extends AbstractController
{
/**
* @throws \JsonException
*/
public function testGet(): void
{
$this->assertTrue(true);
$controller = new IndexController();
$response = $controller->get($this->getMockRequest());
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('{"status_code":200,"message":"Server is running"}', (string)$response->getBody());
}
}

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\Facades;
use Siteworxpro\App\Services\Facade;
use Siteworxpro\Tests\Unit;
abstract class AbstractFacade extends Unit
{
abstract protected function getFacadeClass(): string;
abstract protected function getConcrete(): string;
public function testFacadeAccessor(): void
{
/** @var Facade | string $class */
$class = $this->getFacadeClass();
$this->assertTrue(
method_exists($class, 'getFacadeAccessor'),
sprintf('The class %s must implement the method getFacadeAccessor.', $class)
);
$facade = $class::getFacadeRoot();
$this->assertNotNull(
$facade,
sprintf('The facade %s is not properly initialized.', $this->getConcrete())
);
}
}

View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\Facades;
use Predis\Client;
use Siteworxpro\App\Services\Facades\Redis;
class RedisTest extends AbstractFacade
{
protected function getFacadeClass(): string
{
return Redis::class;
}
protected function getConcrete(): string
{
return Client::class;
}
}

View File

@@ -7,8 +7,8 @@ namespace Siteworxpro\Tests\Http\Middleware;
use Nyholm\Psr7\Response; use Nyholm\Psr7\Response;
use Nyholm\Psr7\ServerRequest; use Nyholm\Psr7\ServerRequest;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Siteworxpro\App\Facades\Config;
use Siteworxpro\App\Http\Middleware\CorsMiddleware; use Siteworxpro\App\Http\Middleware\CorsMiddleware;
use Siteworxpro\App\Services\Facades\Config;
use Siteworxpro\Tests\Unit; use Siteworxpro\Tests\Unit;
class CorsMiddlewareTest extends Unit class CorsMiddlewareTest extends Unit

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\ServiceProviders;
use Illuminate\Container\Container;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Support\ServiceProvider;
use Siteworxpro\Tests\Unit;
abstract class AbstractServiceProvider extends Unit
{
abstract protected function getProviderClass(): string;
/**
* @throws BindingResolutionException
*/
public function testProvider(): void
{
$container = new Container();
$providerClass = $this->getProviderClass();
/** @var ServiceProvider $providerClass */
$provider = new $providerClass($container);
$this->assertInstanceOf($providerClass, $provider);
$provider->register();
$bindings = $provider->bindings;
foreach ($bindings as $abstract => $concrete) {
$this->assertTrue($container->bound($abstract), "The $abstract is not bound in the container.");
$this->assertNotNull($container->make($abstract), "The $abstract could not be resolved.");
$this->assertInstanceOf(
$concrete,
$container->make($abstract),
"The $abstract is not an instance of $concrete."
);
}
}
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\ServiceProviders;
use Siteworxpro\App\Services\ServiceProviders\LoggerServiceProvider;
class LoggerServiceProviderTest extends AbstractServiceProvider
{
protected function getProviderClass(): string
{
return LoggerServiceProvider::class;
}
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\ServiceProviders;
use Siteworxpro\App\Services\ServiceProviders\RedisServiceProvider;
class RedisServiceProviderTest extends AbstractServiceProvider
{
protected function getProviderClass(): string
{
return RedisServiceProvider::class;
}
}

View File

@@ -5,21 +5,29 @@ declare(strict_types=1);
namespace Siteworxpro\Tests; namespace Siteworxpro\Tests;
use Illuminate\Container\Container; use Illuminate\Container\Container;
use Illuminate\Support\Facades\Facade;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Siteworxpro\App\Facades\Config; use Siteworx\Config\Config as SWConfig;
use Siteworxpro\App\Services\Facade;
use Siteworxpro\App\Services\Facades\Config;
abstract class Unit extends TestCase abstract class Unit extends TestCase
{ {
/**
* @throws \ReflectionException
*/
protected function setUp(): void protected function setUp(): void
{ {
$container = new Container(); $container = new Container();
Facade::setFacadeApplication($container); Facade::setFacadeContainer($container);
$container->bind(SWConfig::class, function () {
return SWConfig::load(__DIR__ . '/../config.php');
});
} }
protected function tearDown(): void protected function tearDown(): void
{ {
Config::clearResolvedInstances(); Config::clearResolvedInstances();
Facade::setFacadeApplication(null); Facade::setFacadeContainer(null);
} }
} }