gordon-matt / peachpie-responsive-file-manager

Responsive File Manager running on .NET Core with Peachpie
24 stars 16 forks source link

ResponsiveFileManager.AspNetCore #12

Closed jakubmisek closed 4 years ago

jakubmisek commented 4 years ago
jakubmisek commented 4 years ago

Hi @gordon-matt - this is PR that introduces ResponsiveFileManager.AspNetCore package containing the logic for integrating ResponsiveFileManager into ASP.NET Core application. It hides all the PHP magic and provides standard API

Users would reference ResponsiveFileManager.AspNetCore package only, and then add app.UseResponsiveFileManager() only.

gordon-matt commented 4 years ago

Fantastic! I have been meaning to do this myself for a while, but have been too busy. Thank you very much.

gordon-matt commented 4 years ago

Small question: Do we really want app.UsePhp(); inside UseResponsiveFileManager ? It's possible maybe they want to use PeachPie for other purposes as well and then maybe we end up with 2 calls to UsePhp? Or maybe they want to set some PhpRequestOptions using the overload? Is it possible to detect if UsePhp has already been called once? If not, only then do we set it ourselves. What do you think?

EDIT: Nevermind... that would mean we have to think about AddPhp() in AddResponsiveFileManager() as well... so I am not sure if there's a perfect solution for people using PeachPie for multiple purposes. I am guessing 99% of people using this project won't be using PeachPie for anything else anyway and if they do, they can ignore the AspNetCore package and only use the base package and set the options themselves in Startup like we were doing before.

gordon-matt commented 4 years ago

Packages released on NuGet

jakubmisek commented 4 years ago

That's a good point!

I suppose as you said, they can use UsePhp + UseStaticFiles instead of UseResponsiveFileManager in case they need more PHP handlers.

Or, PeachPie should provide more parameters to its API

UsePhp( string pathPrefix, Action<IPhpOptions> options = null )
// or
UsePhp( Assembly phpAssembly, Action<IPhpOptions> options = null )
// or ...

or something similar to MVC's UseEndpoints. , so component developers like you or like our WordPress could be more specific about options in specific paths.

gordon-matt commented 4 years ago

@jakubmisek Yes, I was thinking of a situation where maybe someone wants to use this file manager, but then maybe later I make another project with a PHP chat room or help chat, for example.. would that even be possible to use both together? Or can PeachPie only handle one PHP application in this scenario?

jakubmisek commented 4 years ago

As of now, it would work normally, there would just be two handlers installed. Therefore, the second one would not be necessary.

For that case, the API I've noted above would make sense.