How to add Library to Fabrik

Via composer is almost always the most hassle-free method. Assuming your hosting provider has composer installed (there are not many who doesn't), then you just need to create ssh-connection to your server and run
"composer require giggsey/libphonenumber-for-php" from command line.

Then you need to load the autoload.php file, e.g. in your form template's default.php like:
require_once '/your/host/vendor/autoload.php';

Replace /your/host/ with the folder structure according to where your hosting installs the autoload.php.

And the you can have a validation code in element php validation plugin according to examples here:
https://github.com/giggsey/libphonenumber-for-php#quick-examples

So you validate and return either true or false in php validation plugin.

Those are just an ideas that should work, but I haven't tested anything like this (at least the last parts from requiring autoload.php in template and using the code in validation plugin).
 
Actually, I was thinking to add library to Fabrik vendor folder like dompdf, so that other users also can take advantage of this validation.

This would be definitely the best choice, but it requires some work in several Fabrik core files and then a Github pull request which then would be needed to commit by Media A-Team. So this options can get complicated.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top