laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

Real-Time Facade Support

Open tobzsc opened this issue 7 years ago • 15 comments

I have tried several version from latest stable to latest master. The package does not have real-time facade support, doesn't it?

Is there any way to add such a feature?

tobzsc avatar Jul 20 '18 10:07 tobzsc

There was also a discussion about this for laravel https://github.com/laravel/ideas/issues/647

tobzsc avatar Jul 20 '18 10:07 tobzsc

That would be awesome indeed!

Laravel generates files that I believe could be leveraged by the package (as mentioned by @barryvdh in the discussion linked above) to provide the necessary doc blocks / jump to source capabilities. See screenshot of generated files: https://cl.ly/9cac6d888a9a

🙏

beNjiox avatar Sep 15 '18 11:09 beNjiox

This would be a giant help especially with testing, anyone got any ideas on how to start it?

i-bajrai avatar Nov 18 '19 11:11 i-bajrai

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

stale[bot] avatar Jul 29 '20 00:07 stale[bot]

The issue is still present in v2.7.0.

rogatty avatar Jul 29 '20 06:07 rogatty

Meanwhile, is there a workaround for this?

yangm97 avatar Aug 11 '20 16:08 yangm97

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

stale[bot] avatar Nov 09 '20 16:11 stale[bot]

The issue is still present in v2.8.1. I don't know of any workarounds but am slowly starting to think we need to stop using real time facades in our project 🙄

rogatty avatar Nov 18 '20 07:11 rogatty

No the right place for this discussion I know, but I don't use Facades at all.

It's always better to explicitly declare your dependencies (constructor injection).

Of course these are not "your next blog" projects, but they're bigger etc. ide-helper is still invaluable especially the phpdoc of properties on models, now that static analyzers also take advantage of them.

Not all but most/many facades to have already very useful phpdoc in Laravel so most things will work already sufficient enough in modern IDEs.

mfn avatar Nov 18 '20 08:11 mfn

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

stale[bot] avatar Feb 18 '21 03:02 stale[bot]

+1

prattcmp avatar Jan 06 '22 23:01 prattcmp

For anyone looking at this thread, in your folder storage/framework/cache, you will find files like

facade-0ddfd85831f9b9c062057cf8727fa4f6ec6410ef.php

Inside, you'll have the real time facade generated, looking like

<?php

namespace Facades\App\Services\CreateProductImages;

use Illuminate\Support\Facades\Facade;

/**
 * @see \App\Services\CreateProductImages\CreateProductImages
 */
class CreateProductImages extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'App\Services\CreateProductImages\CreateProductImages';
    }
}

Doing a search and replace on @see --> @mixin will give PHPStorm (didn't test on other IDEs) auto "jump to source" and autocomplete.

This is not ideal but it works. Not sure if this is laravel-ide-helper territory though.

Hope this helps!

beNjiox avatar Feb 18 '22 09:02 beNjiox

I'm not using them either, but if it's easy to do, we might add them? If there is a PR, let me know.

barryvdh avatar Jul 17 '23 09:07 barryvdh

@barryvdh I created a PR for this now :) https://github.com/barryvdh/laravel-ide-helper/pull/1455

filipac avatar Jul 27 '23 14:07 filipac

Any plans to look at this ? Could be real helpfull!

Pab89 avatar Nov 09 '23 08:11 Pab89