vuestorefront / vue-storefront

Alokai is a Frontend as a Service solution that simplifies composable commerce. It connects all the technologies needed to build and deploy fast & scalable ecommerce frontends. It guides merchants to deliver exceptional customer experiences quickly and easily.
https://www.alokai.com
MIT License
10.65k stars 2.08k forks source link

Create PHP based version of vue-storefront-api #1965

Closed pkarw closed 4 years ago

pkarw commented 6 years ago

What is the motivation for adding / enhancing this feature?

From the feedback we got it seems that the Node.js backend API layer could be a barrier, especially for experienced M2 PHP developers who would like to keep all the API methods closely to Magento and with single technology.

The idea is to create a native Magento2 module like https://github.com/DivanteLtd/magento1-vsbridge which will be 100% compliant with vue-storefront-api

By doing so Magento2 developers might have easily extend the API.

What are the acceptance criteria

bitbager commented 6 years ago

That would be just more than great for a quick kickstart, although I think that in long term it'd make the API management a little bit complicated. Chances are this bridge would follow specific codestyle & design and maintaining an API and connector instead of a single simple API would be tough. IMHO a perfect approach would be to provide a lite package with simple models, interfaces & factories, which is well documented & tested at the same time.

If I were you, I'd design following layers:

  1. View - simple model classes responsible for the presentation (not only could it be an API endpoint, it also could be a view for ES index)
  2. View factory - factories for views with all the necessary parameters in the constructor
  3. Command - Simple action data classes, like AddToCartCommand, LoginCommand, etc. I think it would be great to provide an interface for every command to be easily extended by following DI rules.
  4. CommandHandler - Handling command objects and data stored in them in an easy & extendable way

I'd also use PHPSpec for testing the classes, because it's quite simple & stupid (in a good sense) tool, designed for dealing with business logic only.

This kind of architecture could be easily wrapped as Symfony bundle (following all the recommended practices) as well as it could be used in any PHP framework or platform.

janmyszkier commented 6 years ago

IMO this is not necessary and not needed.

If you decide to develop vueSF (as in vueJS), you probably know node already (you should). If you know only PHP, you won't be able to develop vueSF store easily anyway.

API app/module is not needed for anything but VueSF. If someone doesn't need vueSF then why would PHP-based API help him at all? to install API backend module (instead of api backend app) and then forward work to some node-knowing frontend anyway? This doesn't make sense.

It would also make it harder to separate vue parts from magento and put them on separate host, which was the core idea behind it - decoupling. It's easier to cleanup node API backend right now when vueSF is not needed too, which won't be so easy if you decide to put it up as a magento module along with additional elasticsearch requirement.

Maintenance and docs is already a problem, see how integration boilerplate docs is not even up to date right now, this additional thing to maintain will just make it worse. Unless DivanteLtd is ready to put some serious resources into writing tests and update docs, this will make potential devs more frustrated with the product (because docs won't tell the truth) so not a good idea in the long term.

I'm posting a big NO here, contrary to the opinion above. The vueSF is a growing product and is prone to change. Creating this may slow down the development OR make one solution or the other fall behind because if you know only one language (i.e PHP because you're experienced Magento dev) you won't be able to contribute to both. PRs won't be accepted for the sake of compatibility, and this will slow things down even more.

kesonno commented 6 years ago

My main concern is the focus too strict on Magento. I think that a better modularization of VS-api should be achieved, but it's important that it continue to exists as an agnostic actor of the system, in charge of responsibilities common to every platform (eg. the communication with ES and exposing the catalog APIs).

pkarw commented 6 years ago

@kesonno got your point. Probably this is sth @bitbager is trying to achieve - abstract Symfony2 based API where You can add any platform connector.

For me it's a perfect solution - hoping @bitbager will implement it. Then having this abstract PHP proxy sbd. can just add Magento2 ORM calls and that's it!

bitbager commented 6 years ago

Starting with tomorrow: https://github.com/BitBagCommerce/VueStorefrontPhpBridge 😎

filrak commented 6 years ago

@kesonno sounds like a great approach! With architecture like this it'll be much easier to integrate diffeernt services responsible for different functionalities (e.g. using something else than magento for shopping cart). I agree that this is a way to go ;)

pkarw commented 6 years ago

Hello! @bitbager how about the status in here? :)

bitbager commented 6 years ago

We are on it. We plan to get it done by the end of the year on top of with Sylius integration. The good thing is that we now have some resources and plan to make it available.

On Tue, 20 Nov 2018 at 21:23, Piotr Karwatka notifications@github.com wrote:

Hello! @bitbager https://github.com/bitbager how about the status in here? :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DivanteLtd/vue-storefront/issues/1965#issuecomment-440417046, or mute the thread https://github.com/notifications/unsubscribe-auth/AbOEOnP6ZDV9GCgowRtfNF7GN3RG0C3Pks5uxGTKgaJpZM4YRYRq .

-- Mikołaj Król CEO & Co-founder

mikolaj.krol@bitbag.pl (+48) 797 954 681

pkarw commented 6 years ago

That's awesome; howeve I saw the repo empty - maybe some community members would like to get involved and help You with this if You have published some incremental progress? Just an idea

bitbager commented 6 years ago

We will publish some code soon. I think we will make it on our own. However, if there's a need for more resources, we will let you know and get Sylius community involved as well. Thank you! :)

wt., 20 lis 2018 o 21:31 Piotr Karwatka notifications@github.com napisał(a):

That's awesome; howeve I saw the repo empty - maybe some community members would like to get involved and help You with this if You have published some incremental progress? Just an idea

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DivanteLtd/vue-storefront/issues/1965#issuecomment-440419312, or mute the thread https://github.com/notifications/unsubscribe-auth/AbOEOoXNjYXdvJYcByMpAGMZRiGcKxAyks5uxGasgaJpZM4YRYRq .

-- Mikołaj Król CEO & Co-founder

mikolaj.krol@bitbag.pl (+48) 797 954 681

pkarw commented 5 years ago

How are things @bitbager? :)

Not sure if it will be any helpful but we’re to publish CoreShop (Pimcore eCommerce module) integration next week - https://github.com/DivanteLtd/coreshop-vsbridge

bitbager commented 5 years ago

Hi!

We are on it. We decided to develop a Sylius connector first by the end of this year and once we do it, we will make a plain PHP connector skeleton on top of it.

On Sat, 1 Dec 2018 at 19:22, Piotr Karwatka notifications@github.com wrote:

How are things @bitbager https://github.com/bitbager? :)

Not sure if it will be any helpful but we’re to publish CoreShop (Pimcore eCommerce module) integration next week - https://github.com/DivanteLtd/coreshop-vsbridge

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DivanteLtd/vue-storefront/issues/1965#issuecomment-443446863, or mute the thread https://github.com/notifications/unsubscribe-auth/AbOEOkzlJM3zHjjnIF37rjsChTSW4Pajks5u0sjKgaJpZM4YRYRq .

-- Mikołaj Król CEO & Co-founder

mikolaj.krol@bitbag.pl (+48) 797 954 681

CodeSkills commented 5 years ago

When this gets done, I'm able to make Laravel package so anyone can easily setup a Laravel Bridge -> VSF.

ruthgeridema commented 5 years ago

When this gets done, I'm able to make Laravel package so anyone can easily setup a Laravel Bridge -> VSF.

More than willing to help with this one!

pkarw commented 5 years ago

Great! Go on as far as I know @bitbager is not working on this at the moment

MikeSheward commented 5 years ago

When this gets done, I'm able to make Laravel package so anyone can easily setup a Laravel Bridge -> VSF.

This would be interesting too! Any idea how it would work if @bitbager implementation isn't going ahead? Would it rely on that?

Cool-and-Deadly commented 5 years ago

Is the Sylius integration still planned?

mattbryanswan commented 5 years ago

Does anyone have a status on this? It would be of primary interest to our implementation. I'd like to contribute or jumpstart it if it's gone cold.

pkarw commented 5 years ago

Hi Matt; nothing is going on here afaik; This might be usefull for you to quick-start: https://github.com/DivanteLtd/vue-storefront-integration-sdk