Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2, 8.3]
php: [8.3, 8.4]
include:
- php: 8.1
laravel: 9.*
testbench: 7.*
- php: 8.2
laravel: 10.*
testbench: 8.*
- php: 8.3
laravel: 11.*
testbench: 9.*
- php: 8.4
laravel: 12.*
testbench: 10.*

name: PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }}

Expand All @@ -49,4 +46,4 @@ jobs:
run: composer show -D

- name: Execute tests
run: vendor/bin/phpunit --exclude-group skipped
run: composer test
76 changes: 0 additions & 76 deletions CODE_OF_CONDUCT.md

This file was deleted.

41 changes: 31 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
# Contributing

Contributions are welcome and will be fully credited.
Contributions are **welcome** and will be fully **credited**.

Contributions are accepted via Pull Requests on Github.
Please read and understand the contribution guide before creating an issue or pull request.

## Pull Requests
## Etiquette

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)**.
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.

**Happy coding**!
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.

## Viability

When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.

## Procedure

Before filing an issue:

- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.

Before submitting a pull request:

- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
39 changes: 31 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Laravel Helpers

[![Latest Version on Packagist](https://img.shields.io/packagist/v/devtical/laravel-helpers.svg?style=flat-square)](https://packagist.org/packages/devtical/laravel-drunk-on-419)
[![Total Downloads](https://img.shields.io/packagist/dt/devtical/laravel-helpers.svg?style=flat-square)](https://packagist.org/packages/devtical/laravel-drunk-on-419)

Helper Generator for Laravel

## Installation
Expand All @@ -16,13 +12,36 @@ composer require devtical/laravel-helpers

Publish the config by running the `php artisan vendor:publish` command.

Configure your helper directory:
```bash
# In your .env file
HELPER_DIRECTORY=Helpers
```

## Usage

Create your first helper file:
```bash
php artisan make:helper <NAME>
```
Add your helper functions:
```php
<?php

if (!function_exists('str_slug')) {
function str_slug($text, $separator = '-')
{
return Str::slug($text, $separator);
}
}
```

Use your helper functions anywhere:
```php
// In your controllers, models, views, etc.
$slug = str_slug('Hello World'); // Returns: hello-world
```

## Change log

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

Expand All @@ -42,9 +61,13 @@ If you discover any security related issues, please email author instead of usin

## Credits

- [Wahyu Kristianto](https://github.com/wearedevtical)
- [All contributors](https://github.com/wearedevtical/laravel-helpers/graphs/contributors)
- [Wahyu Kristianto](https://github.com/kristories)
- [All contributors](https://github.com/devtical/laravel-helpers/graphs/contributors)

## License

The MIT License (MIT). Please see the [license file](LICENSE.md) for more information.
This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

## Support

If you have any questions or need help, please open an issue on GitHub.
20 changes: 14 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
{
"name": "devtical/laravel-helpers",
"description": "Helper Generator for Laravel",
"version": "2.0.0",
"keywords": [
"devtical",
"laravel",
"helper",
"generator"
],
"homepage": "https://github.com/devtical/laravel-helpers",
"license": "MIT",
"authors": [
{
"name": "W Kristianto",
"email": "w.kristories@gmail.com"
}
],
"require": {
"php": "^7.2|^8.0",
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0"
},
"require-dev": {
"laravel/pint": "^1.18",
"orchestra/testbench": "^4.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^8.4 || ^9.0 || ^10.0 || ^11.0",
"friendsofphp/php-cs-fixer": "^3.0"
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -43,10 +52,9 @@
}
},
"scripts": {
"format": "vendor/bin/pint",
"test": "vendor/bin/pest --colors=always",
"analyse": "vendor/bin/phpstan analyse"
"test": "vendor/bin/pest --no-coverage",
"format": "vendor/bin/pint"
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true
}
11 changes: 10 additions & 1 deletion config/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

return [

'directory' => 'Helpers',
/*
|--------------------------------------------------------------------------
| Helper Directory
|--------------------------------------------------------------------------
|
| This option controls the directory where your helper files will be stored.
| The directory is relative to the app_path().
|
*/
'directory' => env('HELPER_DIRECTORY', 'Helpers'),

];
Empty file removed phpstan-baseline.neon
Empty file.
9 changes: 0 additions & 9 deletions phpstan.neon.dist

This file was deleted.

24 changes: 17 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="League Test Suite">
<testsuite name="Laravel Helpers Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
9 changes: 9 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"preset": "laravel",
"rules": {
"no_unused_imports": true,
"ordered_imports": {
"sort_algorithm": "alpha"
}
}
}
Loading