Hi everyone :)
I have just started using ProcessWire, and I really do think it is a great CMF. The only thing, though, is that is is not [yet] put together with Composer.
I have a site, and I would like to process contact forms with a ProcessWire module, using the Validation compnent. In addition, I would need to make use of the Mail component to send the emails.
As I understand it, the best way to go about this is via Composer. This is where I get stuck, as I can't seem to find a decent user guide that explains how to use the Illuminate components outside of Laravel. (There are a few, but not for Validation or Mail).
Just to give you an idea, ProcessWire has two folders in the document root: wire
(the system) and site
(all site-specific segments).
Inside the site
folder exists a modules
folder, which contains all the available site Modules that ProcessWire can make use of (like extensions or plugins).
I have created a module called ProcessContactForm
, and I need to import the above-mentioned Illuminate components so that the module can use them.
How could I go about doing this? Could I use composer within my module directory (/site/modules/ProcessContactForm/vendor
) or should everything be in the root (/vendor
)? Once loaded, I know I need to require vendor/autoload.php
, but past that, I have no idea how to instantiate everything.
Thanks in advance :)
Just to be clear, I want to make use of the two components in my Module exactly the same way I would in a normal Laravel app.
Validator::make(...)
and Mail::send(...)
I have figured it out - was actually quite easy. (Forgive me, I'm a newbie to the Illuminate Components).
I've basically pulled the required packages into my vendor
directory (which wasn't there before, obviously), and imported them into my module. Of course, I already knew how to do that - the issue was how to make use of the components.
For Validation, I used the Factory
as it needs the Translator
.
As for Mail
, I haven't gotten there yet.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community