PHPackages                             hoangphi/hwa-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hoangphi/hwa-tools

Abandoned → [hwavina/hwa-meta](/?search=hwavina%2Fhwa-meta)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

hoangphi/hwa-tools
==================

A package about helper function and meta tools. Development by Phi Hoang

v1.0.5(4y ago)2411MITPHPPHP ^7.2|^8.0

Since Jul 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hoangphidev/hwa-tools)[ Packagist](https://packagist.org/packages/hoangphi/hwa-tools)[ Docs](https://github.com/hoangphidev/hwa-tools)[ RSS](/packages/hoangphi-hwa-tools/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

[![](https://camo.githubusercontent.com/bdcbed2056f451eff0c3af422466b367497824756388badbe6d3aa8e18b6f4e1/68747470733a2f2f68776176696e612e636f6d2f6173736574732f696d616765732f6c6f676f2d312e706e67)](https://github.com/hoangphidev/hwa-tools)

[![Total Downloads](https://camo.githubusercontent.com/f25ea68374fd253da050e820725e07e446c49d07ea33229143031b7ac148400d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686f616e677068692f6877612d746f6f6c73)](https://packagist.org/packages/hoangphi/hwa-tools)[![Latest Stable Version](https://camo.githubusercontent.com/e5d0d1b5c082c9c0129bc295a1880da9667ecb3b4d5fabc3254d9b796cabceb6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686f616e677068692f6877612d746f6f6c73)](https://packagist.org/packages/hoangphi/hwa-tools)[![License](https://camo.githubusercontent.com/8b0c777d11cc0da39a3e05da12234277d5187917a44fcdffed80986270e5934a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f686f616e677068692f6877612d746f6f6c73)](https://packagist.org/packages/hoangphi/hwa-tools)

About
-----

[](#about)

[hwa-tools](https://github.com/hoangphidev/hwa-tools) is a helper package. It helps us to build and develop faster with pre-built functions. This saves a lot of time on future projects.

We share this package to give programmers an extra useful library. We hope people use this package not for commercialization or profit of any kind.

And finally, hope to receive more contributions and shares from all of you.

Thank you very much 🧡

Install
-------

[](#install)

1. You can install the package via composer:

```
composer require hoangphi/hwa-tools
```

2. Optional: The service provider will automatically get registered. Or you may manually add the service provider in your `config/app.php` file:

```
'providers' => array(
    // ...
    HoangPhi\HwaTools\Providers\HwaToolServiceProvider::class,
);
```

3. You can customize the [`config/hwa_tools.php` config file](https://github.com/hoangphidev/hwa-tools/blob/master/config/hwa_tools.php) . If you customize file `config/hwa_tools.php`. You need to run the command below to clear cache and update the changes.

```
php artisan config:cache

# or

php artisan optimize:clear
```

### Default config file contents

[](#default-config-file-contents)

You can view the default config file contents at:

[https://github.com/hoangphidev/hwa-tools/blob/master/config/hwa\_tools.php](https://github.com/hoangphidev/hwa-tools/blob/master/config/hwa_tools.php)

Usage
-----

[](#usage)

### Helpers

[](#helpers)

Since this is a package with helper functions, after installing the package into the project, people can call the helper functions everywhere in the project.

Here are some helper functions we've built:

1. Commons

```
app_name(); // Get website name, project name - Ex: Laravel

activate_status(); // Get status activate - Ex: 1 - activate

deactivate_status(); // Get status deactivate - Ex: 2 - deactivate

gender_male(); // Get gender male - Ex: 1 - male

gender_female(); // Get gender female - Ex: 1 - female

page_limit(); // Get page limit default in pagination - Ex: 12

check_active_menu($menu, $url); // Check active menu. $menu is router menu
```

2. Datetime

```
current_day(); // Get current day - Ex: 01

current_month(); // Get current month - Ex: 07

current_year(); // Get current year - Ex: 2021

current_date(); // Get current - Ex: 2021-07-01 00:00:01

current_date('H:i:s d/m/Y'); // Get current date with format - Ex: 00:00:01 01/07/2021

custom_date('2021-07-01 00:00:01', 'H:i:s d/m/Y'); // Get customer date with format - Ex: 00:00:01 01/07/2021

custom_date('2021-07-01 00:00:01', 'H:i:s d/m/Y', 'en_EN'); // Get customer date with format and locale for diffForHumans - Ex: 00:00:01 01/07/2021 or 1 seconds or 1 minutes.

get_list_timezones(); // Get list timezones - response array
```

3. Images

```
storage_folder_path('users'); // Check and create folder if not existed in storage.

storage_image_path('users', '1.jpg') // Check and get image from image storage path.

storage_image_url('users', '1.jpg') // Get public asset url image from storage.
```

4. Ip info

```
get_user_agent(); // Get user agent

get_current_ip(); // Get current client ip

get_ip_info('127.0.0.1'); // Get info ip from http://api.ipstack.com

get_client_ip(); // Get client ip from https://ipinfo.io

code_to_country('EN'); // Convert country code to country name. Ex: EN to English

get_os(); // Get OS client using

get_client_browser(); // Get client browser using

get_device(); // Get client device using

get_country_list(); // Get list country world

get_list_currency(); // Get list currency
```

5. Response API

```
send_ok_response('Message.', ['name' => 'Phi Hoang', 'phone' => '0989324221']); // Response normal with param 1 is message, param 2 is object or array data.

send_ok_response('Message.', '', true); // Response with param 1 is message, param 2 is data paginate include results with meta, param 3 is boolean true to paginate.

send_created_response('Message.', 1); // Response with code 201 - param 1 is message, param 2 is id.

send_error_response('Message', 400); // Response error with code 400 is default. Message compare with code [401, 404, 403, 500].
```

### MetaTools

[](#metatools)

This tool helps you to easily manage the extended data fields of certain objects.

1. Create Meta Class with command.

Example: We need CustomerMeta. This tools help us make model file and migration file.

```
php artisan hwa:make:meta Customer -m
```

The above command we have added -m to create the migration file.

2. Add allow type to `config/hwa_tools.php`

```
'allow_type' => [
    .....
    'customer' => ['id', 'customer_id'],
],
```

3. You need to run the command below to clear cache and update the changes.

```
php artisan config:cache

# or

php artisan optimize:clear
```

4. Run command to migrate the meta migration file to database

```
php artisan migrate
```

After completing the above configuration steps you can use the methods available in the meta model in the classes you want.

```
// Example
CustomerMeta:_update(1, 'gender', 'male'); // update or add new gender for customer has id is 1
```

Beside the functions and methods we have built, people can also build their own by inheriting our classes.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Security
--------

[](#security)

If you discover a security vulnerability within [hwa-tools](https://github.com/hoangphidev/hwa-tools), please send an e-mail to [Phi Hoang](https://github.com/hoangphidev) via . All security vulnerabilities will be promptly addressed.

Credits
-------

[](#credits)

- [Phi Hoang](https://github.com/hoangphidev)
- [Hwavina Inc.](https://github.com/hwavina)
- [All Contributors](../../contributors)

License
-------

[](#license)

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Total

6

Last Release

1672d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/557a3eb75039e39d7f1635b552a16aa969390decd1aeeb8f92edce1ee2951289?d=identicon)[HoangPhi](/maintainers/HoangPhi)

---

Top Contributors

[![hoangphidev](https://avatars.githubusercontent.com/u/32218935?v=4)](https://github.com/hoangphidev "hoangphidev (11 commits)")

---

Tags

hwa-helpershwa-toolshwavinalaravellaravel-helperslaravel-packagemeta-dataphp-helperphp-helperslaravelhelperhelperspackagelaravel-packagelaravel-helperslaravel-helperlaravel-package-helperhoangphidevlaravel-package-helpershwa-vina-helpershwa-helperhwa-helpershoangphi-helpershoangphidev-helpershwa-vinametatoolsmeta-toolslaravel-metatoolslaravel-meta-toolslaravel-package-meta-toolslaravel-package-metatoolshwa-metatoolshwa-toolshoangphi-hwa-toolshoangphidev-hwa-tools

### Embed Badge

![Health badge](/badges/hoangphi-hwa-tools/health.svg)

```
[![Health](https://phpackages.com/badges/hoangphi-hwa-tools/health.svg)](https://phpackages.com/packages/hoangphi-hwa-tools)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
