Download the PHP package quarry/customer-uuid without Composer
On this page you can find all versions of the php package quarry/customer-uuid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package customer-uuid
Magento 2 Customer UUID Attribute Extension
Objective
This Magento 2 extension introduces a new read-only attribute, uuid
, for customers. The extension ensures the uniqueness of the UUID for each customer and automatically assigns it to existing and new customers. The uuid
attribute is exposed through a public GraphQl API for authenticated users and is also be displayed in the customer grid.
Key Features and Implementation Details
- The extension uses UUID version 4, in accordance with Magento's best practices. UUID version 4 provides a very high probability of uniqueness due to its reliance on random values.
- The extension uses Magento 2's plugin architecture, to intercept customer save and update operations. During this interception, new UUIDs are assigned and existing ones are re-validated.
- Upon installation, the extension auto-assigns UUIDs to all the existing customers. This is implemented using Magento's data patches.
- After the extension is installed, all new customers created thereafter are auto-assigned a UUID, just before the customer record is committed to the database.
- Before any customer (new or existing) is assigned a UUID, the extension ensures that the same UUID is not assinged to another customer.
- To enforce data integrity, the extension always re-validates the existing UUID for a customer, whenever changes are made to the customer record, either from admin panel or storefront. If the assigned UUID is invalid, a new one is generated, validated and assigned. A UI notification is also displayed on both admin panel and storefront.
- UUIDs are displayed on customer grid, as read-only and are filterable, searchable and sortable.
- An authenticated user can read the UUID through the GraphQl API
- Extension logs all the UUID transactions to a log file.
Magento Compatability
This extension has been developed and tested on Magento 2 version 2.4.6-p2
, with no other third-party extensions installed.
Setting-up Testing Environment
This docker-compose.yml can be used to quickly spin-up a local testing environment, with Magento 2.4.6-p2, mariadb and elastic search installed. Once the docker-compose.yml
file is downloaded, docker-compose up -d
can be used to download the docker images and setup the containers and volumes.
Recommended Steps Before Extension Installation
- Ensure that Magento installation has a few customers created. This will allow the extension to auto-assign UUID during installation.
- The extension logs all UUID transations to
<magento_root>/var/log/quarry_customeruuid.log
. Please ensure this log file has write-permissions enabled. If not, the extension falls back to PHP's system logger. -
Enable Magento's developer mode
- Disable Magento's cache
Extension Installation Process
-
Install the extension using composer:
-
Flush Magento's cache
-
Clean Magento's cache
-
Enable the UUID extension
-
Run Magento setup upgrade:
- Run di compile:
Verify the Extension Installation
1. Existing customers are auto-assigned UUID during extension installation.
Expected outcome:
- Customer grid, should show a new column labelled
UUID
, with UUIDs assigned to all the existing customers. - These read-only UUIDs must be filterable, searchable and sortable in the customer grid.
- Log file should show all the exsiting customer IDs, to whom new UUIDs have been assigned. Log entry message should be in following format:
2. New customers created from admin panel, are auto-assigned UUID
Expected outcome:
- The new customer record must show up in the customer grid, with a UUID assigned.
- The log file should contain an entry for this transaction. Log entry message should be in following format:
2. New customers created from storefront, are auto-assigned UUID
Expected outcome:
- The new customer record should show up in the admin customer grid, with a UUID assigned.
- The log file should contain an entry for this transaction. Log entry message should be in following format:
3. UUID is accessible through GraphQl API, for authenticated users.
For authenticated users, UUID is accessible via GraphQL API on the Customer object. Magento's GraphQl endpoint is /graphql
and can be accessed at http://<your-domain.com>/graphql
. It is recommended to use a GraphQl client like Postman to access this endpoint.
First, a bearer toekn must be obtained by calling GenerateCustomerToken
mutation.
Example:
Next, this auth token must be passed along with the GraphQl query to retrieve UUID. Sample GraphQl query to retrieve UUID:
Below is a sample response to the above GraphQl query:
Extension Uninstallation Process
-
Disable the UUID extension
-
Uninstall the UUID extension
-
Remove the extension using composer:
-
Flush Magento's cache
-
Clean Magento's cache
-
Run Magento setup upgrade:
- Run di compile: