Coder Social home page Coder Social logo

helpers's Introduction

Helpers

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This is a helpers package that provides some built in helpers, and also provides an Artisan generator to quickly create your own custom helpers.

Install

Via Composer

$ composer require browner12/helpers

Setup

Add the service provider to the providers array in config/app.php.

'providers' => [
    browner12\helpers\HelperServiceProvider::class,
];

If you are using Laravel's automatic package discovery, you can skip this step.

Publishing

You can publish everything at once

php artisan vendor:publish --provider="browner12\helpers\HelperServiceProvider"

or you can publish groups individually.

php artisan vendor:publish --provider="browner12\helpers\HelperServiceProvider" --tag="config"

Usage

This package comes with some built in helpers that you can choose to use or not. By default all of these helpers are inactive for your application. To adjust which helpers are active and which are inactive, open config/helpers.php and find the package_helpers option. Add any helpers you wish to activate to this key. Check the source code to see what functions are included in each helper and what each does.

You can also create your own custom helpers for inclusion in your application. An Artisan generator helps you quickly make new helpers for your application.

php artisan make:helper MyHelper

Your custom helper will be placed in app/Helpers, unless you override the default directory in your configuration.

By default, the service provider uses the glob function to automatically require any PHP files in the 'Helpers' directory. If you prefer a mapper based approach, you may edit the custom_helpers in the configuration file, and include the file name of any helpers in your custom directory you wish to activate. Within the new helper, define your own custom functions that will be available throughout your application.

if (!function_exists('hello')) {

    /**
     * say hello
     *
     * @param string $name
     * @return string
     */
    function hello($name)
    {
        return 'Hello ' . $name . '!';
    }
}

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

helpers's People

Contributors

browner12 avatar dylan-dpc avatar joemires avatar laravel-shift avatar spaantje avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

helpers's Issues

Lumen compatibility

Is there any way this package would work with a Lumen application? Or some way to make it work? I'd love to have my custom helpers available in my Lumen app.

Can't install in laravel 6.xx

Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for browner12/helpers ^3.0 -> satisfiable by browner12/helpers[v3.0.0]. - Conclusion: remove laravel/framework v5.8.11 - Conclusion: don't install laravel/framework v5.8.11 - browner12/helpers v3.0.0 requires illuminate/support ^6.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.2.0, v6.3.0, v6.4.1, v6.5.0]. - Can only install one of: laravel/framework[6.x-dev, v5.8.11]. - don't install illuminate/support 6.x-dev|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.0.0|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.0.1|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.0.2|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.0.3|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.0.4|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.1.0|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.2.0|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.3.0|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.4.1|don't install laravel/framework v5.8.11 - don't install illuminate/support v6.5.0|don't install laravel/framework v5.8.11 - Installation request for laravel/framework (locked at v5.8.11, required as 5.8.*) -> satisfiable by laravel/framework[v5.8.11]. Installation failed, reverting ./composer.json to its original content.

Is it compatible with laravel 5.3?

php artisan vendor:publish --provider="browner12\helpers\HelperServiceProvider" This command returns that there is nothing to publish.
php artisan make:helper MyHelper This command returns an error that artisan doesn't have helper as an action.

Thanks

php artisan make:helper MyHelper show problem

php artisan make:helper MyHelper
do last step show problem:
[Symfony\Component\Console\Exception\CommandNotFoundException] Command "make:helper" is not defined. Did you mean one of these? make:auth make:command make:controller make:event make:job make:listener make:mail make:middleware make:migration make:model make:notification make:policy make:provider make:request make:seeder make:test

Unable to override laravel helper functions

I'm trying to override a default laravel helper (logger) but is not working.

if (!function_exists('logger')) {
    function logger($message = null, array $context = [])
    {
        if (is_null($message)) {
            return app('log');
        } 

        return app('log')->debug('test', $context);
    }
}

Is there a way to make this work?

Error after run php artisan optimize:clear

Hello sir, Hope you are doing well.

I faced a problem with my application.
I have a helper function called jsonResponseFormat() which was made by php artisan make:helper fname with your package.
When I install composer on a server it auto-discover the package and everything work perfectly.
But, When I run php artisan optimize:clear then its show me the error.
image

Here is my composer config:
image
image

I have added it in providers on app.php

image

Thanks in advanced

Laravel 9 for composer command

Can you release latest version for composer require command?

Because composer require browner12/helpers not working in laravel 9

Re-inventing a wheel

Hey man, plz take a look at:
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/ClassLoader.php

It already implements what this package does, except with ClassLoader you can load classes from anywhere within your project.

Excerpt:

    public static function load($class)
    {
        $class = static::normalizeClass($class);
        foreach (static::$directories as $directory) {
            if (file_exists($path = $directory.DIRECTORY_SEPARATOR.$class)) {
                require_once $path;
                return true;
            }
        }
        return false;
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.