helpers

Catalogs OrangeHRM helper traits and services for reuse in PHP feature code.

Updated Jul 23, 2026
Ready to run
npx skills add https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone --skill helpers-snow-gift111
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: helpers
Source: https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone/tree/main/.agents/skills/helpers
Command: npx skills add https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone --skill helpers-snow-gift111

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers working in the OrangeHRM codebase often rewrite utility logic (date formatting, string operations, current-user lookup, caching) that already exists as a helper trait or service, leading to duplicated code and inconsistent conventions. ## Core Features & Use Cases - Helper Catalog: Maps every framework-wide trait (DateTimeHelperTrait, TextHelperTrait, LoggerTrait, CacheTrait, AuthUserTrait, UserRoleManagerTrait, EntityManagerHelperTrait, and more) to the service it exposes and its common use case. - Cheat Sheet Lookup: Provides an "Is there a helper for..." table so you can find the right use statement before writing any utility function. - New Helper Guidance: Includes recipes and checklists for adding a new helper service plus matching trait following the existing lazy-instantiation pattern. - Use Case: Before writing a date-formatting function in a new service, consult this catalog and discover DateTimeHelperTrait already handles timezone-aware formatting via getDateTimeHelper()->formatDate(). ## Quick Start Ask the agent to check the helpers catalog for an existing OrangeHRM helper trait before writing a new utility function for date formatting, string operations, or current-user lookup.

Frequently Asked Questions about helpers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I format dates in OrangeHRM respecting user timezone?▼

Use DateTimeHelperTrait in your class and call $this->getDateTimeHelper()->formatDate($date) or getNow(). This respects the user's timezone, unlike calling new DateTime() directly, which the codebase conventions prohibit.

How do I get the current logged-in user in OrangeHRM?▼

Use AuthUserTrait and call $this->getAuthUser()->getUserId() or getEmpNumber(). Note this only works inside a request lifecycle; in console commands or migrations the session is not bound and it returns null.

When should I add a new helper service in OrangeHRM?▼

Add one when the same non-trivial logic appears in at least two places, or when it needs DI access to config, the entity manager, or the dispatcher. Create a service class plus a matching trait with lazy instantiation, mirroring TextHelperService and TextHelperTrait.

Can I instantiate OrangeHRM helper services directly with new?▼

No, you should use the corresponding trait instead of calling new ConfigService() or similar. Traits cache the instance per class and keep the convention discoverable; bypassing them causes extra instantiations and breaks the pattern other developers search for.

What happens if two PHP traits define the same method name?▼

PHP throws a fatal error when two used traits define the same method. OrangeHRM trait method names are distinctive so this is rare, but if you see a trait method conflict error, rename one of the colliding methods.