| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This simple command-line application demonstrates how to invoke Google DLP API from PHP.
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
$ cd php-docs-samples/dlp
$ php src/inspect_string.php
Usage: php src/inspect_string.php PROJECT_ID STRING
$ php src/inspect_string.php your-project-id 'bob@example.com'
Findings:
Quote: bob@example.com
Info type: EMAIL_ADDRESS
Likelihood: LIKELYSee the DLP Documentation for more information.
export GOOGLE_PROJECT_ID=YOUR_PROJECT_ID
export GOOGLE_STORAGE_BUCKET=YOUR_BUCKET export GCS_PATH=gs://GOOGLE_STORAGE_BUCKET/test.txt
export DLP_DEID_WRAPPED_KEY=YOUR_ENCRYPTED_AES_256_KEY export DLP_DEID_KEY_NAME=projects/GOOGLE_PROJECT_ID/locations/YOUR_LOCATION/keyRings/YOUR_KEYRING_NAME/cryptoKeys/YOUR_KEY_NAME
export DLP_DEIDENTIFY_TEMPLATE=YOUR_DEFAULT_DEIDENTIFY_TEMPLATE export DLP_STRUCTURED_DEIDENTIFY_TEMPLATE=YOUR_STRUCTURED_DEIDENTIFY_TEMPLATE export DLP_IMAGE_REDACT_DEIDENTIFY_TEMPLATE=YOUR_IMAGE_REDACT_TEMPLATE
Name,TelephoneNumber,Mystery,Age,Gender
James,(567) 890-1234,8291 3627 8250 1234,19,Male
Gandalf,(223) 456-7890,4231 5555 6781 9876,27,Male
Dumbledore,(313) 337-1337,6291 8765 1095 7629,27,Male
Joe,(452) 223-1234,3782 2288 1166 3030,35,Male
Marie,(452) 223-1234,8291 3627 8250 1234,35,Female
Carrie,(567) 890-1234,2253 5218 4251 4526,35,Female
export DLP_DATASET_ID=YOUR_BIGQUERY_DATASET_ID export DLP_TABLE_ID=YOUR_TABLE_ID
Email : john@doe.com Person Name : John Phone Number : 343-343-3435 Email : gary@doe.com Person Name : Gary Phone Number : 343-443-3136
export DLP_NAMESPACE_ID=YOUR_NAMESPACE_ID export DLP_DATASTORE_KIND=YOUR_DATASTORE_KIND
If you see an error like this:
PHP Fatal error: Uncaught Error: Call to undefined function Google\Protobuf\Internal\bccomp() in /usr/local/google/home/crwilson/github/GoogleCloudPlatform/php-docs-samples/dlp/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php:986
You may need to install the bcmath PHP extension. e.g. (may depend on your php version)
$ sudo apt-get install php8.1-bcmath
| Back | FazBrowse Home | New Git URL |