Code Monkey home page Code Monkey logo

eventy's Introduction

Hi there ๐Ÿ‘‹

eventy's People

Contributors

bosunski avatar caneco avatar dancameron avatar deatil avatar dependabot[bot] avatar lloy0076 avatar mattallan avatar minhkhoablieu avatar philipnewcomer avatar rashcms avatar stevemoretz avatar stylecibot avatar tormjens 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  avatar  avatar  avatar  avatar  avatar  avatar

eventy's Issues

Laravel 10 issue

The package is very good. I tested it in Laravel 10 but it gives following error.
"A facade root has not been set."
Will the package be updated for this version?

this package not work in laravel 5.7

Hi .
i installed this package on my project . i used laravel 5.7 .
first i didnt set facade and providers in app.php and i tryed to use from Eventy facade. but didnt work .

1

then i set facade and providers in app.php but didn`t work again .

2

or

3

4

then when i used Eventy::action i see this error :

5

please help me .
thanks

Difference between Actions & Filters in Examples

Thank you for all your hard work on this, I'm really excited about using it in a future project.

As someone very new to Laravel I'm reluctant to open this ticket, however as a WordPress developer (for ~15 years) I feel obligated to mention the differences between "actions" and "filters" isn't demonstrated well within the examples, since they're practically the same.

I'd suggest passing variables in hooks, otherwise it's just a filter. This would help not only with differentiate the two but show the power of creating an action hook.

use TorMorten\Eventy\Facades\Events as Eventy;
Eventy::action('my.hook', $user);
Eventy::addAction('my.hook', function($user) {
    if ($user->is_awesome) {
         $this->doSomethingAwesome($user);
    }
}, 20, 1);

Especially in regards to templating.

@action('my.hook', $user)
@action('my.hook')

Maybe an example you can use for "Using it to enable extensibility".

Here's an example of an action being added to the a blade template for extensibility by plugins that can be conditionally loaded.

@foreach ($posts as $post)
    ...
    <p>{{ $post->body }}</p>
    ...
    @action('blade-posts-loop-post', $post)
@endforeach
use TorMorten\Eventy\Facades\Events as Eventy;
class SharePostsController
{
    public function boot()
    {
        Eventy::addAction('blade-posts-loop-post', function($post) {
            echo '<a href="'.$post->url.'">Share this post</a>';
            printf('<a href="https://xyz.com?share='.$post->url.'">Share this post</a>');
        });
    }
}

use TorMorten\Eventy\Facades\Events as Eventy;
class CommentsPostsController
{
    public function boot()
    {
        Eventy::addAction('blade-posts-loop-post', function($post) {
            echo 'Comments: ' . count($post->comments);
        });
    }
}

Accepting array callables

First off, good work on the package! It's one of the better bits of Wordpress and you've made it really easy to use.

I do have a small issue though. Currently I can pass a closure:

Eventy::addAction('foo', function() {
     echo 'bar';
});

...or a string

Eventy::addAction('foo', 'someClass@baz');

...but I can't pass a callable array:

Eventy::addAction('foo', [$this, 'bar']);

This would be really helpful as it would allow me to access the current scope of $this which processing the action.

This could be achieved by updating the Event getFunction method to the following:

protected function getFunction($callback)
{
    if (is_string($callback) && strpos($callback, '@')) {
        $callback = explode('@', $callback);
        return array(app('\\' . $callback[0]), $callback[1]);
    } else if (is_callable($callback)) {
        return $callback;
    } else {
        throw new Exception('$callback is not a Callable', 1);
    }
}

If this looks good to you I can submit a pull request.

Cheers!

Decrease the 5.5 requirement to 5.3

Hey, firstly very awesome package!

I've got a project that is running the Lumen v5.3 and I'm currently having to manually include the eventy package files into my project because of the 5.5 illuminate/support requirement.

I'm curious if you see any issues with decreasing the requirement from 5.5 as it appears to work fine on 5.3 (i could be missing something)

I would be happy to push up a patch to reduce the requirement to 5.3, if you okay with it, I can also push up some notes on installation for Lumen (different steps required to the ones in your readme)

use Eventy in other system, other than Lavarel

Hello, sir,

Thank you for this package. It's really great. So, I'm trying to explore the possibility that whether I can use it in my project. It's a CMS, and without Laravel, or composer.

I think the core of Eventy is mature enough so that it can be independent from Laravel. I think the core of Eventy does not need the two provider classes, or the Facades directory, does it ? since they are Laravel-specific. If I don't use it in Laravel, I don't need them. Is it possible?

image

And in the HashedCallable class, can we use other way to replace the Laravel SerializableClosure? I mean, with a simple way, not using another package. But if we really have to use Laravel SerializableClosure, I think it's okay, since the package Laravel serializable-closure has zero dependency. I just add it to the vendor along with your excellent Eventy. But I really hope we can replace it with another simpler way to serialize callbacks.

image

Could you help me answer these questions? Thank you.

How to use this to build a plugin system

I, too, come from the WordPress world, so this project is perfect for me.

What I'm struggling with is trying to figure out how I might build a plugin system around this. I still haven't nailed down the Laravel execution path. Would I need to create a service provider and load it prior to the Eventy providers?

Too few arguments error

If one of the parameters passed to \Eventy::filter() (or 'action()') is null you will get "Too few arguments..." error:

    \Eventy::addFilter('filter_name', function($test1, $test2) {
        return $test1;
    }, 20, 2);

    $test1 = 1;
    $tes2 = null;
    \Eventy::filter('filter_name', $test1, $test2);

Release 0.5.2 to Packagist

Hey there,

I've just installed via composer and it's pulling down 0.5.1, which doesn't include EventBladeServiceProvider.php.

Could you possibly push 0.5.2 to Packagist so we can pull from composer ๐Ÿ˜„

Cheers

Class 'TorMorten\Eventy\Exception' not found

Class 'TorMorten\Eventy\Exception' not found in Event.php line 62

Looks like you either need to use Exception; or throw new \Exception

I'd submit a pull request but I'm right in the middle of something.

I do not know what is action and filter in Wordpress

I have a gut feeling that this tool is something very useful, but I do not know what is action and filter in Wordpress, as I never learnt Wordpress, can someone update the document/readme to give more generic explanation or use case about, how these actions and filters can be used in a Laravel project.

Does this support queue

First of all, thank you so very much for this wonderful package..

What i would like to know now is, does this packages support queue?

Secondly it seems most of my application logic would reside in service-provider or is there something I'm not getting.

I await your humble clearance,

Thanks in advance

Target class does not exist.

hi:

Eventy::addAction('app_admin_assets', '_maybe_init_admin_project_assets', 5);

function _maybe_init_admin_project_assets()
{

echo 'hi';
}
get error:

Target class [_maybe_init_admin_project_assets] does not exist.

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.