{"id":22354463,"url":"https://github.com/mcmatters/laravel-helpers","last_synced_at":"2025-07-23T04:34:02.780Z","repository":{"id":62526156,"uuid":"69609905","full_name":"MCMatters/laravel-helpers","owner":"MCMatters","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-27T12:44:37.000Z","size":196,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T03:03:50.948Z","etag":null,"topics":["helpers","laravel","laravel-5-package"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MCMatters.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-29T21:36:32.000Z","updated_at":"2025-04-16T21:24:36.000Z","dependencies_parsed_at":"2025-02-27T14:26:47.215Z","dependency_job_id":"5183b76c-b64d-4ae4-8f62-ac0c28e66d23","html_url":"https://github.com/MCMatters/laravel-helpers","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/MCMatters/laravel-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCMatters%2Flaravel-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCMatters%2Flaravel-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCMatters%2Flaravel-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCMatters%2Flaravel-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MCMatters","download_url":"https://codeload.github.com/MCMatters/laravel-helpers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCMatters%2Flaravel-helpers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266618818,"owners_count":23957273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["helpers","laravel","laravel-5-package"],"created_at":"2024-12-04T13:12:59.400Z","updated_at":"2025-07-23T04:34:02.752Z","avatar_url":"https://github.com/MCMatters.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Helpers\n\n[![Latest Stable Version](https://poser.pugx.org/mcmatters/laravel-helpers/v/stable)](https://packagist.org/packages/mcmatters/laravel-helpers)\n[![Total Downloads](https://poser.pugx.org/mcmatters/laravel-helpers/downloads)](https://packagist.org/packages/mcmatters/laravel-helpers)\n\n## Installation\n\n`composer require mcmatters/laravel-helpers`\n\nThen run the command\n\n```bash\nphp artisan vendor:publish --provider=\"\\McMatters\\Helpers\\ServiceProvider\"\n```\n\nIf you prefer manual installation, then add to `config/app.php` into `providers` section next line:\n\n```php\n'providers' =\u003e [\n    McMatters\\Helpers\\ServiceProvider::class,\n],\n```\n\nOtherwise it will be autodiscovered.\n\n## Configuration\n\nSince `v2.0`, you can disable all helper functions and use helper classes, if you prefer to use helper functions, you can choose what exactly section do you want to use (`array`, `dev`, `string`, etc)\n\n## Functions\n\n- [Arrays](#arrays)\n- [Artisan](#artisan)\n- [Class](#class)\n- [Database](#database)\n- [Dev](#dev)\n- [Env](#env)\n- [Math](#math)\n- [Model](#model)\n- [Request](#request)\n- [Server](#server)\n- [String](#string)\n- [Type](#type)\n- [Url](#url)\n\n### Arrays\n\n#### `array_first_key(array $array)`\n\nThe `array_first_key` function returns first key from the given array.\n\n#### `array_has_with_wildcard(array $array, string $keys, bool $searchWithSegment)`\n\nThe `array_has_with_wildcard` is analogue of function `array_has` with ability to search with wildcard. Also it can search keys with dots (i.e. when you want to get some data from multiple field when validation is failed).\n\n#### `array_key_by(array $array, string $key)`\n\nThe `array_key_by` function returns a new associative array grouped by `$key`.\n\n#### `array_contains(array $array, string $needle, bool $byKey = false)`\n\nThe `array_contains` function returns true if array contains given `$needle`. You can also search by array keys. This function searches only in first level of array.\n\n#### `array_has_only_int_keys(array $array)`\n\nThe `array_has_only_int_keys` function checks whether keys of given array as integer or not.\n\n#### `shuffle_assoc(array $array)`\n\nThe `shuffle_assoc` function works like basic `shuffle` but with key preserving.\n\n#### `array_change_key_case_recursive(array $array, int $case = CASE_LOWER)`\n\nThe `array_change_key_case_recursive` function works like `array_change_key_case` except that it works recursively.\n\n### Artisan\n\n#### `get_php_path()`\n\nThe `get_php_path` function returns path to executable `php`.\n\n#### `get_artisan()`\n\nThe `get_artisan` function return path to executable `artisan`.\n\n#### `run_background_command(string $command, array $parameters = [])`\n\nThe `run_background_command` function runs the given command in background.\n\n### Class\n\n#### `get_class_constants($class)`\n\nThe `get_class_constants` function returns an array with all class constants.\n\n#### `get_class_constants_start_with($class, string $string)`\n\nThe `get_class_constants_start_with` function returns an array with constants which start with passed string.\n\n### Database\n\n#### `compile_sql_query($sql, array $bindings = null)`\n\nThe `compile_sql_query` function replaces all placeholders given bindings.\n\n#### `get_all_tables(bool $withColumns = true, string $connection = null)`\n\nThe `get_all_tables` function returns the list all tables with their columns.\n\n#### `search_entire_database(string $keyword, string $connection = null)`\n\nThe `search_entire_database` function searches entire database. It works only with MySQL and SQL drivers.\n\n#### `has_query_join_with($query, string $with)`\n\nThe `has_query_join_with` function determines whether query has a joined table.\n\n## Dev\n\n#### `ddq($query, bool $die = false)`\n\nThe `ddq` is analogue of function `dd`, but uses only for database queries.\n\n#### `dump($value, bool $output = false)`\n\nThe `dump` is analogue of function `dd`, but without stopping the php script execution.\n\n### Env\n\n#### `is_production_environment()`\n\nThe `is_production_environment` function checks whether the production environment is using.\n\n#### `is_local_environment()`\n\nThe `is_local_environment` function checks whether the local environment is using.\n\n#### `is_testing_environment()`\n\nThe `is_testing_environment` function checks whether the testing environment is using.\n\n### Math\n\n#### `calculate_percentage($count, $total, int $decimals)`\n\nThe `calculate_percentage` function calculates percentages.\n\n#### `calculate_discount($discount, $total, int $decimals)`\n\nThe `calculate_discount` function calculates discount.\n\n#### `calculate_with_discount($discount, $total, int $decimals)`\n\nThe `calculate_with_discount` function calculates price with discount.\n\n#### `has_float_remainder(float $number)`\n\nThe `has_float_remainder` function checks whether the remainder of the float is not zero.\n\n#### `convert_bytes($value, string $returnType)`\n\nThe `convert_bytes` function converts bytes between any sizes.\n\n#### `get_size_types()`\n\nThe `get_size_types` function returns the list all available size types.\n\n#### `is_number_even($number)`\n\nThe `is_number_even` function checks whether the number is even.\n\n#### `is_number_odd($number)`\n\nThe `is_number_odd` function checks whether the number is odd.\n\n#### `is_number_in_range($number, $from, $to)`\n\nThe `is_number_in_range` function checks whether the number is in a given range.\n\n## Model\n\n#### `get_model_from_query($query)`\n\nThe `get_model_from_query` function returns a model from a query.\n\n#### `destroy_models_from_query($query)`\n\nThe `destroy_models_from_query` function destroy all models from a query. Useful when you want to delete many models with calling model's hooks.\n\n#### `is_morphed_belongs_parent(Model $morphed, Model $parent, string $name, string $type, string $id)`\n\nThe `is_morphed_belongs_parent` function determines whether morphed model is belongs to parent.\n\n### Request\n\n#### `is_request_method_update($request)`\n\nThe `is_request_method_update` function checks whether the current request method is for updating.\n\n### Server\n\n#### `long_processes()`\n\nThe `long_processes` function sets the maximum value of the optimal configuration for the server to perform long operations.\n\n#### `get_upload_max_filesize(string $returnType)`\n\nThe `get_upload_max_filesize` function returns the value of the `upload_max_filesize` from `php.ini` in any of the formats.\n\n#### `get_post_max_size(string $returnType)`\n\nThe `get_post_max_size` function returns the value of the `post_max_size` from `php.ini` in any of the formats.\n\n#### `is_max_post_size_exceeded()`\n\nThe `is_max_post_size_exceeded` function checks whether is the permissible size of the value `post_max_size` exceeded.\n\n#### `get_max_response_code()`\n\nThe `get_max_response_code` function returns maximum available value for response code.\n\n### String\n\n#### `str_lower(string $string)`\n\nThe `str_lower` is function wrapper over `Str::lower`.\n\n#### `str_upper(string $string)`\n\nThe `str_upper` is function wrapper over `Str::upper`.\n\n#### `str_ucwords(string $string)`\n\nThe `str_ucwords` function converts a value to studly caps case with spaces.\n\n#### `strpos_all(string $haystack, string $needle, bool $caseInsensitive = false)`\n\nThe `strpos_all` function returns all occurrences of `$needle` in a `$haystack`\n\n### Type\n\n#### `random_bool()`\n\nThe `random_bool` function returns a random boolean value.\n\n#### `casting_bool($value, bool $default)`\n\nThe `casting_bool` function returns casted boolean value. \n\n#### `is_json($json, $returnDecoded)`\n\nThe `is_json` function check whether passed string is a json.\n\n#### `is_uuid($string)`\n\nThe `is_uuid` function check whether passed value is a valid uuid value.\n\n## Url\n\n#### `get_base_url(string $url)`\n\nThe `get_base_url` function returns base url.\n\n#### `get_host_url(string $url, bool $stripWww = true)`\n\nThe `get_host_url` function returns host url.\n\n#### `routes_path(string $path)`\n\nThe `routes_path` function returns path to `routes` folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmatters%2Flaravel-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcmatters%2Flaravel-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmatters%2Flaravel-helpers/lists"}