GravityPDF / gravity-pdf

Gravity PDF is the ultimate third-party PDF automation tool for generating digital PDFs using the popular form-builder plugin Gravity Forms.
https://gravitypdf.com
89 stars 20 forks source link
gravity-forms pdf-generation php wordpress-plugin

Gravity PDF

codecov

Gravity PDF is a GPLv2-licensed WordPress plugin that allows you to automatically generate, email and download PDF documents using the popular form-builder plugin, Gravity Forms (affiliate link). Find out more about Gravity PDF at https://gravitypdf.com.

About

This Git repository is for developers who want to contribute to Gravity PDF. Don't use it in production. For production use, download from GravityPDF.com.

The development branch is considered our bleeding edge branch, with all new changes pushed to it. All releases are tagged appropriately.

Installation

Prerequisites

Setup for Docker

The Docker setup will create a fully functional development environment preconfigured for Gravity PDF.

  1. Clone the repository using git clone https://github.com/GravityPDF/gravity-pdf/ from the terminal
  2. Copy and rename .env.example to .env, then replace 00000000000000000000000000000000 with a valid Gravity Forms license key
  3. Run yarn && yarn build:production
  4. Start Docker and then run yarn env:install to setup the local development environment
  5. Access a local development site at http://localhost:8888 with the login admin and password.

If you shut down Docker and want to fire up the environment later, use yarn wp-env start. You can reset the database back to its original state with yarn wp-env clean all. When all else fails, delete everything and start again with yarn wp-env destroy.

See the WordPress Developer Handbook for more details about managing the docker environment.

Enable X-Debug

X-Debug is enabled by default for step debugging and profiling. If you need to use other X-Debug modes you can manually start the environment and pass the appropriate modes in: yarn wp-env start --xdebug=profile,trace,debug.

Switch PHP Versions

The default version that will be configured is PHP8.0. If you want to change this you can adjust the phpVersion value in the .wp-env.json file and then stop and start the environment with yarn wp-env start.

Setup without Docker

If you would rather use your own development environment, you can build Gravity PDF using the following commands.

  1. Clone the repository using git clone https://github.com/GravityPDF/gravity-pdf/
  2. Run yarn && yarn build:production
  3. Run composer install
  4. Run composer run prefix

Building JavaScript

If you are making changes to any of the JavaScript or CSS, run yarn build:dev to ensure the files automatically gets built when you make changes on the file system.

Linting

To lint your JS code use yarn lint:js, and to try automatically fix it use yarn lint:js:fix.

To lint your PHP code, use composer lint, and to try automatically fix it use composer lint:fix.

Automated Tests

The automated test suite can only be run using Docker.

E2E

Useful commands include:

yarn test:e2e
yarn test:e2e:headless

PHPUnit

Run full suite of tests using yarn test:php or yarn test:php:multisite.

JavaScript

The JavaScript unit tests can be run with yarn test:js

Documentation

All documentation can be found at https://docs.gravitypdf.com.