### Mautic install command with parameters
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
Example of running the installation command with specific parameters provided via the CLI.
```bash
path/to/php bin/console mautic:install https://m.example.com
--mailer_from_name="Example From Name" --mailer_from_email="mautic@localhost"
--mailer_transport="smtp" --mailer_host="localhost" --mailer_port="1025"
--db_driver="pdo_mysql" --db_host="db" --db_port="3306" --db_name="db" --db_user="db" --db_password="db"
--db_backup_tables="false" --admin_email="admin@mautic.local" --admin_password="Maut1cR0cks!"
```
--------------------------------
### Example local.php configuration
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
A sample local.php file used to define database and mailer settings for the installation.
```php
'localhost',
'db_table_prefix' => null,
'db_port' => 3306,
'db_name' => 'mautic',
'db_user' => 'mautic',
'db_password' => 'mautic',
'db_backup_tables' => false,
'db_backup_prefix' => 'bak_',
'admin_email' => 'admin@example.com',
'admin_password' => 'Maut1cR0cks!',
'mailer_transport' => null,
'mailer_host' => null,
'mailer_port' => null,
'mailer_user' => null,
'mailer_password' => null,
'mailer_api_key' => null,
'mailer_encryption' => null,
'mailer_auth_mode' => null,
);
```
--------------------------------
### Initialize WordPress Development Environment
Source: https://docs.mautic.org/en/7.1/plugins/wordpress.html
Run these commands to install dependencies, build assets, and start the Docker-based WordPress environment.
```bash
npm install
npm run build:dev
npm run env:start
npm run env:install
```
--------------------------------
### Full template configuration example
Source: https://docs.mautic.org/en/7.1/builders/email_landing_page.html
A complete example of a configuration file for a Mautic theme supporting multiple builders.
```json
{
"name": "Blank",
"author": "Mautic team",
"authorUrl": "https://mautic.org",
"builder": ["legacy", "grapesjsbuilder"],
"features": ["page", "email", "form"]
}
```
--------------------------------
### Mautic install command options
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
List of available flags and options for the mautic:install command.
```text
--db_driver=DB_DRIVER Database driver. [default: "pdo_mysql"]
--db_host=DB_HOST Database host.
--db_port=DB_PORT Database port.
--db_name=DB_NAME Database name.
--db_user=DB_USER Database user.
--db_password=DB_PASSWORD Database password.
--db_table_prefix=DB_TABLE_PREFIX Database tables prefix.
--db_backup_tables=DB_BACKUP_TABLES Backup database tables if they exist; otherwise drop them. [default: true]
--db_backup_prefix=DB_BACKUP_PREFIX Database backup tables prefix. [default: "bak_"]
--admin_firstname=ADMIN_FIRSTNAME Admin first name.
--admin_lastname=ADMIN_LASTNAME Admin last name.
--admin_username=ADMIN_USERNAME Admin username.
--admin_email=ADMIN_EMAIL Admin email.
--admin_password=ADMIN_PASSWORD Admin user.
--mailer_from_name[=MAILER_FROM_NAME] From name for email sent from Mautic.
--mailer_from_email[=MAILER_FROM_EMAIL] From email sent from Mautic.
--mailer_transport[=MAILER_TRANSPORT] Mail transport.
--mailer_host=MAILER_HOST SMTP host.
--mailer_port=MAILER_PORT SMTP port.
--mailer_user=MAILER_USER SMTP username.
--mailer_password[=MAILER_PASSWORD] SMTP password.
--mailer_encryption[=MAILER_ENCRYPTION] SMTP encryption (null|tls|ssl).
--mailer_auth_mode[=MAILER_AUTH_MODE] SMTP auth mode (null|plain|login|cram-md5).
--mailer_spool_type=MAILER_SPOOL_TYPE Spool mode (file|memory).
--mailer_spool_path=MAILER_SPOOL_PATH Spool path.
```
--------------------------------
### Date/Time Format Example
Source: https://docs.mautic.org/en/7.1/contacts/import_contacts.html
Example of the recommended ISO8601 date/time format for contact imports.
```text
2019-01-02 19:08:42
```
--------------------------------
### Install AMQP dependency
Source: https://docs.mautic.org/en/7.1/configuration/settings.html
Install the required Composer dependency for the AMQP transport.
```bash
composer require symfony/amqp-messenger
```
--------------------------------
### Certificate Directory Structure Example
Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html
Example of the expected directory structure for S/MIME certificates within the path defined by smime_certificates_path.
```text
/var/smime_certificates/
├── admin@example.com.crt
├── admin@example.com.pem
├── support@example.com.crt
└── support@example.com.pem
```
--------------------------------
### Install SendGrid Transport via Composer
Source: https://docs.mautic.org/en/7.1/configuration/settings.html
Command to install the official Symfony SendGrid transport plugin when Mautic is installed via Composer.
```bash
composer require symfony/sendgrid-mailer
```
--------------------------------
### Mautic installation output
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
Sample output displayed during the Mautic installation process, including status checks and completion confirmation.
```text
Mautic Install
==============
Parsing options and arguments...
0 - Checking installation requirements...
Missing optional settings:
- [0] The memory_limit setting in your PHP configuration is lower than the suggested minimum limit of %min_memory_limit%. Mautic can have performance issues with large datasets without sufficient memory.
Ready to Install!
1 - Creating database...
1.1 - Creating schema...
1.2 - Loading fixtures...
2 - Creating admin user...
3 - Email configuration and final steps...
================
Install complete
================
```
--------------------------------
### Configure RabbitMQ in local configuration
Source: https://docs.mautic.org/en/7.1/queue/queue.html
Example configuration parameters for connecting Mautic to a RabbitMQ server.
```php
'queue_protocol' => 'rabbitmq',
'rabbitmq_host' => 'b-180b97c2-6b05-4b10-80ed-09182eac3a02.mq.us-west-1.amazonaws.com',
'rabbitmq_port' => '5671',
'rabbitmq_vhost' => '/',
'rabbitmq_user' => 'some_user',
'rabbitmq_password' => 'some_password',
'rabbitmq_idle_timeout' => 0,
'rabbitmq_idle_timeout_exit_code' => 0,
```
--------------------------------
### Start Mautic development environment with DDEV
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
Initialize and start the DDEV environment within the Mautic directory to spin up services like Mailhog, PHPMyAdmin, and Redis Commander.
```bash
ddev start
```
--------------------------------
### Install Bitly bundle via Composer
Source: https://docs.mautic.org/en/7.1/configuration/shortener.html
Use this command to install the Bitly bundle for Mautic 5 via Composer.
```bash
composer require webmecanik/mautic-bitly-bundle
```
--------------------------------
### Install Mautic Sparkpost plugin
Source: https://docs.mautic.org/en/7.1/configuration/settings.html
Composer command to install the Mautic Sparkpost plugin for enhanced transport support.
```bash
composer require ts-navghane/sparkpost-plugin
```
--------------------------------
### Search Marketplace Plugins
Source: https://docs.mautic.org/en/7.1/marketplace/marketplace.html
Example command to filter the plugin list for a specific term, such as 'Captcha'.
```bash
bin/console mautic:marketplace:list --filter=captcha
```
--------------------------------
### Install Amazon SQS dependency
Source: https://docs.mautic.org/en/7.1/configuration/settings.html
Install the required Composer dependency for the Amazon SQS transport.
```bash
composer require symfony/amazon-sqs-messenger
```
--------------------------------
### Initialize new project without installation
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
Run the create-project command with the --no-install flag to prepare a new Mautic project directory before modifying the folder structure.
```bash
composer create-project mautic/recommended-project:^5 some-dir --no-interaction --no-install
```
--------------------------------
### Staggered cron job schedule example
Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html
An example of how to stagger cron jobs to prevent them from running at the exact same minute.
```text
- 0,15,30,45 <— mautic:segments:update
- 5,20,35,50 <— mautic:campaigns:update
- 10,25,40,55 <— mautic:campaigns:trigger
```
--------------------------------
### Consume email queue
Source: https://docs.mautic.org/en/7.1/configuration/settings.html
Run this command to start consuming messages from the email queue.
```bash
php bin/console messenger:consume email
```
--------------------------------
### Install Beanstalkd dependency
Source: https://docs.mautic.org/en/7.1/configuration/settings.html
Install the required Composer dependency for the Beanstalkd transport.
```bash
composer require symfony/beanstalkd-messenger
```
--------------------------------
### Example Asset Download URL with UTM Parameters
Source: https://docs.mautic.org/en/7.1/components/assets.html
This URL structure demonstrates how to append UTM parameters to an asset download link to track source, medium, campaign, and other identifiers in reports.
```text
/asset/{id}:{name}?utm_source=test&utm_medium=test&utm_campaign=test&utm_id=test&utm_term=test&utm_content=test
```
--------------------------------
### Add dependencies with Composer
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
Navigate to your project directory and use this command to add new dependencies, such as bundles, to your Mautic installation.
```bash
cd your-directory
composer require mautic/mautic/helloworld-bundle
```
--------------------------------
### Example PHP warning for file access issues
Source: https://docs.mautic.org/en/7.1/troubleshooting/file_ownership_permissions.html
This warning indicates a failure to open a file, often caused by incorrect permissions or ownership on the Mautic instance.
```text
.WARNING: PHP Warning - require(/mautic/var/cache/prod/doctrine/orm/Proxies/__CG__MauticCategoryBundleEntityCategory.php): failed to open stream: No such file or directory - in file /mautic/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php - at line 209
```
--------------------------------
### Change to Mautic directory
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html
Navigate to the directory where Mautic is installed before running update commands.
```bash
cd /your/mautic/directory
```
--------------------------------
### SendGrid API DSN configuration
Source: https://docs.mautic.org/en/7.1/configuration/settings.html
Example DSN string for configuring the SendGrid API transport in Mautic.
```text
sendgrid+api://KEY@default
```
--------------------------------
### Email recipient format example
Source: https://docs.mautic.org/en/7.1/reports/reports.html
Example of the comma-separated format required for specifying multiple email recipients for scheduled reports.
```text
example1@example.com, example2@example.com
```
--------------------------------
### Define custom countries in countries.json
Source: https://docs.mautic.org/en/7.1/contacts/custom_fields.html
Example format for defining custom countries in a JSON file located in the media/files directory.
```json
[
"Middle Earth",
"Fillory"
]
```
--------------------------------
### Define custom regions in regions.json
Source: https://docs.mautic.org/en/7.1/contacts/custom_fields.html
Example format for mapping custom regions to countries in a JSON file located in the media/files directory.
```json
{
"Middle Earth": [
"The Shire",
"Mordor"
],
"Fillory": [
"Castle Whitespire",
"Ember's Tomb"
]
}
```
--------------------------------
### Override PHP settings via .htaccess
Source: https://docs.mautic.org/en/7.1/troubleshooting/working_with_resource_limits.html
Example configuration to override global PHP settings locally within an .htaccess file.
```apache
php_value upload_max_filesize 20M
php_value max_execution_time 600
```
--------------------------------
### Rename docroot to public for existing installations
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
Move the existing docroot directory to public before updating the composer.json configuration.
```bash
mv docroot public
```
--------------------------------
### Tracking Pixel PHP Embedding
Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html
Example of generating a tracking pixel URL using PHP with encoded data.
```php
$d = urlencode(base64_encode(serialize(array(
'page_url' => 'https://' . $_SERVER[HTTP_HOST] . $_SERVER['REQUEST_URI'],
'page_title' => $pageTitle, // Use your website's means of retrieving the title or manually insert it
'email' => $loggedInUsersEmail // Use your website's means of user management to retrieve the email
))));
echo '
';
```
--------------------------------
### Tracking Pixel JavaScript Embedding
Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html
Example of dynamically injecting the tracking pixel into the DOM using JavaScript.
```javascript
```
--------------------------------
### Submit Form via Tracking URL
Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html
Example of a tracking URL used to submit a page view and email address to Mautic.
```text
https://example.com/mtracking.gif?page_url=cart_screen&email=myemail@example.com
```
--------------------------------
### Tracking Pixel HTML Embedding
Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html
Example of embedding the tracking pixel directly into an HTML page with query parameters.
```html
```
--------------------------------
### Reload Mautic plugins
Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html
Command to reload plugins. You can also use mautic:plugins:install or mautic:plugins:update as aliases.
```bash
php /path/to/mautic/bin/console mautic:plugins:reload
```
--------------------------------
### Update Campaigns via CLI
Source: https://docs.mautic.org/en/7.1/campaigns/creating_campaigns.html
Use this command to add or remove contacts in batch for campaigns. Ensure you replace /path/to/mautic/ with your actual Mautic installation path.
```bash
php /path/to/mautic/bin/console mautic:campaigns:update
```
--------------------------------
### Boolean Field Label Modifier Example
Source: https://docs.mautic.org/en/7.1/configuration/variables.html
Demonstrates how the label modifier displays Yes or No instead of 1 or 0 for a boolean field.
```text
{contactfield=is_subscriber}
{contactfield=is_subscriber|label}
```
--------------------------------
### iOS AppDelegate OneSignal integration
Source: https://docs.mautic.org/en/7.1/channels/push_notifications.html
Add this code to the application function of your AppDelegate to initialize OneSignal and sync user data with Mautic. The example uses Swift 3.1 and assumes a hardcoded email address for demonstration.
```swift
// Somehow determine the user email. If you have user accounts, it may be better to move
// this outside of the `application` func of `AppDelegate` in order to determine the user email.
// In this example, the address is hardcoded for ease of use.
let userEmail = "you@domain.com"
OneSignal.initWithLaunchOptions(launchOptions, appId: "YOUR-ONE-SIGNAL-APP-ID")
OneSignal.syncHashedEmail(userEmail);
OneSignal.idsAvailable({(_ userId, _ pushToken) in
let pushId = userId != nil ? userId : ""
let pushEnabled = pushToken != nil ? true : false
let userData = UserData(email: userEmail, push_id: pushId!, enabled: pushEnabled)
self.pushUserDataToMautic(userData, "https://mautic.example.com/notification/appcallback")
});
```
--------------------------------
### Select Field Label Modifier Example
Source: https://docs.mautic.org/en/7.1/configuration/variables.html
Demonstrates how the label modifier displays the human-readable label instead of the stored value for a select field.
```text
{contactfield=country_select}
{contactfield=country_select|label}
```
--------------------------------
### pushUserDataToMautic function
Source: https://docs.mautic.org/en/7.1/channels/push_notifications.html
Use this function to send the UserData struct to your Mautic installation via a POST request. It includes logic to display the Mautic response as an app alert.
```swift
func pushUserDataToMautic(_ userData: UserData, _ url: String) {
var request = URLRequest(url: URL(string: url)!)
request.httpMethod = "POST"
let postString = UserData.toJSON(userData)
request.httpBody = postString.data(using: .utf8)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
// check for fundamental networking error
return
}
if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200 {
// check for http errors
return
}
// Comment the next 4 lines to remove the alert
let responseString = String(data: data, encoding: .utf8)
let alert = UIAlertController(title: "Response Data", message: responseString, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
self.window?.rootViewController?.present(alert, animated: true, completion: nil);
}
task.resume()
}
```
--------------------------------
### Create Mautic project with Composer
Source: https://docs.mautic.org/en/7.1/getting_started/switching_composer.html
Run this command in the /var/www directory to initialize a new Mautic project using Composer.
```bash
composer create-project mautic/recommended-project:^5 html-new --no-interaction
```
--------------------------------
### List Marketplace Plugins
Source: https://docs.mautic.org/en/7.1/marketplace/marketplace.html
Executes the command to list the first page of available plugins in the Mautic Marketplace.
```bash
bin/console mautic:marketplace:list
```
```text
+-------------------------------------------------------+-----------+--------+
| name | downloads | favers |
+----------------------------------------------------+--------+-----+
| mautic/mautic-saelos-bundle | 11623 | 11 |
| koco/mautic-recaptcha-bundle | 2662 | 24 |
| This plugin brings reCAPTCHA integration to | | |
| mautic. | | |
| thedmsgroup/mautic-extended-field-bundle | 3069 | 25 |
| Extends custom fields for scalability and | | |
| HIPAA/PCI compliance. | | |
| mtcextendee/mautic-sql-conditions-bundle | 190 | 6 |
| maatoo/mautic-referrals-bundle | 1063 | 5 |
| This plugin enables referrals in mautic. | | |
| thedmsgroup/mautic-health-bundle | 2139 | 11 |
| Checks the health of the Mautic instance. | | |
| thedmsgroup/mautic-dashboard-warm-bundle | 1921 | 12 |
| Improves the performance of the dashboard by | | |
| sharing/extending/warming caches. | | |
| thedmsgroup/mautic-contact-source-bundle | 2852 | 43 |
| Creates API endpoints for receiving contacts from | | |
| external sources. | | |
| thedmsgroup/mautic-contact-client-bundle | 4035 | 70 |
| Create custom integrations without writing code. | | |
| thedmsgroup/mautic-campaign-watch-bundle | 1817 | 14 |
| Visual improvements for campaigns. | | |
| raow/mautic-rss-to-email-bundle | 971 | 69 |
| mtcextendee/mautic-random-smtp-bundle | 101 | 10 |
| kuzmany/mautic-recommender-bundle | 250 | 30 |
| kuzmany/mautic-custom-tags-bundle | 119 | 20 |
| dazzle/mautic-sendinblue-bundle | 73 | 5 |
| Allows to send E-mails with Sendinblue | | |
+-------------------------------------------------------+-----------+--------+
Total packages: 69
Execution time: 388 ms
```
--------------------------------
### Marketplace List Help Options
Source: https://docs.mautic.org/en/7.1/marketplace/marketplace.html
Displays the available options for filtering and pagination when using the list command.
```bash
-p, --page[=PAGE] Page number [default: 1]
-l, --limit[=LIMIT] Packages per page [default: 15]
-f, --filter[=FILTER] Filter the packages [default: ""]
-h, --help Display this help message
```
--------------------------------
### Company Field Label Modifier Examples
Source: https://docs.mautic.org/en/7.1/configuration/variables.html
Examples of using the label modifier for company select and boolean fields.
```text
{contactfield=company_type|label}
{contactfield=company_active|label}
```
--------------------------------
### List available CLI commands
Source: https://docs.mautic.org/en/7.1/configuration/command_line_interface.html
Run this command to view the list of available CLI commands, including those related to Doctrine and other vendors.
```bash
bin/console
```
--------------------------------
### Check and run database migrations
Source: https://docs.mautic.org/en/7.1/troubleshooting/troubleshooting.html
Identify and execute outstanding database migrations. Ensure a database backup exists before running the migration command.
```bash
php bin/console doctrine:migration:status
```
```bash
php bin/console doctrine:migration:migrate
```
--------------------------------
### Generate self-signed S/MIME certificates with OpenSSL
Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html
Use these OpenSSL commands to create a private key and a self-signed certificate for testing. Replace sender@example.com with your actual sending email address.
```bash
# Create a private key and certificate signing request
openssl req -newkey rsa:4096 -nodes -keyout sender@example.com.pem -out sender@example.com.csr
# Create a self-signed certificate valid for 1 year
openssl x509 -req -days 365 -in sender@example.com.csr -signkey sender@example.com.pem -out sender@example.com.crt
```
--------------------------------
### Fetch contacts from integration
Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html
Commands to synchronize contacts from external integrations.
```bash
php /path/to/mautic/bin/console mautic:integration:fetchleads
```
```bash
php /path/to/mautic/bin/console mautic:integration:synccontacts
```
--------------------------------
### Enable S/MIME in app/config/local.php
Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html
Add these parameters to your local.php file to enable S/MIME signing. Ensure you are using the SMTP transport, as this feature is incompatible with API-based transports.
```php
true,
'smime_certificates_path' => '%kernel.project_dir%/var/smime_certificates',
);
```
--------------------------------
### Navigate to WordPress Directory
Source: https://docs.mautic.org/en/7.1/plugins/wordpress.html
Change your working directory to the newly cloned WordPress development folder.
```bash
cd wordpress-develop
```
--------------------------------
### Import Campaign via CLI
Source: https://docs.mautic.org/en/7.1/campaigns/importing_campaigns.html
Use the mautic:entity:import command to import a campaign ZIP file from the command line.
```bash
bin/console mautic:entity:import \
--entity=campaign \
--file=/tmp/entity_data.zip \
--user=
```
--------------------------------
### GET /api/campaigns/export/{id}
Source: https://docs.mautic.org/en/7.1/campaigns/exporting_campaigns.html
Exports a specific campaign by its ID. The request requires authentication via a Bearer token.
```APIDOC
## GET /api/campaigns/export/{id}
### Description
Exports a specific Campaign by ID. The API returns the campaign data and its dependencies.
### Method
GET
### Endpoint
https://example.com/api/campaigns/export/{id}
### Parameters
#### Path Parameters
- **id** (integer) - Required - The ID of the Campaign to export.
### Request Example
curl --location 'https://example.com/api/campaigns/export/1' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
### Response
#### Success Response (200)
- **content** (binary) - The exported campaign file (typically a ZIP archive).
```
--------------------------------
### Find and apply updates via CLI
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html
Commands to check for available updates and apply them to the Mautic instance.
```bash
php bin/console mautic:update:find
```
```bash
php bin/console mautic:update:apply
```
```bash
php bin/console mautic:update:apply --finish
```
--------------------------------
### Create custom field column command
Source: https://docs.mautic.org/en/7.1/contacts/custom_fields.html
Run this command to create the database column and publish the field metadata after defining a custom field with background processing enabled.
```bash
bin/console mautic:custom-field:create-column
```
--------------------------------
### Theme package file structure
Source: https://docs.mautic.org/en/7.1/builders/creating_themes.html
Displays the required directory layout for a Mautic theme, including assets, html templates, configuration, and a thumbnail.
```text
name.zip
├── assets
│ ├── image1.ext
│ └── image2.ext
├── html
│ ├── email.html.twig
│ ├── email.mjml.twig
│ ├── base.html.twig
│ └── message.html.twig
├── config.json
└── thumbnail.png
```
--------------------------------
### Override translation string in messages.ini
Source: https://docs.mautic.org/en/7.1/translations/translations.html
Example of overriding the 'Dashboard' menu item by defining the translation key in the custom overrides file.
```ini
mautic.dashboard.menu.index="Banana"
```
--------------------------------
### Set Certificate Permissions
Source: https://docs.mautic.org/en/7.1/configuration/smime_email_signing.html
Commands to configure ownership and restrictive permissions for certificate files and directories. Private keys must be set to 600 to prevent unauthorized access.
```bash
# Set ownership (replace www-data with your web server user)
chown -R www-data:www-data /path/to/mautic/var/smime_certificates
# Set directory permissions
chmod 755 /path/to/mautic/var/smime_certificates
# Set certificate permissions
chmod 644 /path/to/mautic/var/smime_certificates/*.crt
chmod 600 /path/to/mautic/var/smime_certificates/*.pem
```
--------------------------------
### Clone Mautic repository using GitHub CLI
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_install_mautic.html
Use the GitHub CLI to clone your personal fork of the Mautic repository to your local machine.
```bash
gh repo clone username/mautic
```
--------------------------------
### Run update commands as web server user
Source: https://docs.mautic.org/en/7.1/getting_started/how_to_update_mautic.html
Commands to find, apply, and finish updates, and clear the cache while running as the web server user (e.g., www-data) to maintain correct file permissions.
```bash
sudo -u www-data php bin/console mautic:update:find
```
```bash
sudo -u www-data php bin/console mautic:update:apply
```
```bash
sudo -u www-data php bin/console mautic:update:apply --finish
```
```bash
sudo -u www-data php /var/www/html/mautic/bin/console cache:clear
```
--------------------------------
### Export Campaign via cURL
Source: https://docs.mautic.org/en/7.1/campaigns/exporting_campaigns.html
Perform a GET request to the Mautic API to export a campaign by its ID, using a Bearer token for authentication.
```bash
curl --location 'https://example.com/api/campaigns/export/1' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
```
--------------------------------
### Specify integration for synchronization
Source: https://docs.mautic.org/en/7.1/configuration/cron_jobs.html
Use the --integration flag to target a specific plugin, such as HubSpot, to avoid performance issues.
```bash
php /path/to/mautic/bin/console mautic:integration:fetchleads --integration=Hubspot
php /path/to/mautic/bin/console mautic:integration:pushactivity --integration=Hubspot
```
--------------------------------
### Configure template for multiple builders
Source: https://docs.mautic.org/en/7.1/builders/email_landing_page.html
Use this syntax to support both the legacy and GrapesJS builders in a single theme.
```json
"builder": ["legacy", "grapesjsbuilder"],
```
--------------------------------
### Run background import command
Source: https://docs.mautic.org/en/7.1/contacts/import_contacts.html
Execute the Mautic import command via CLI. The output displays the progress and summary of processed, created, updated, and ignored items.
```bash
$ bin/console mautic:import
48/48 [============================] 100%
48 lines were processed, 0 items created, 48 items updated, 0 items ignored in 4.78 s
```
--------------------------------
### Validate and restart Apache
Source: https://docs.mautic.org/en/7.1/troubleshooting/working_with_resource_limits.html
Commands to verify Apache configuration syntax and restart the service on different Linux distributions.
```bash
sudo apachectl configtest
```
```bash
sudo systemctl restart apache2
```
```bash
sudo systemctl restart httpd
```
--------------------------------
### Mautic JavaScript Tracking Script
Source: https://docs.mautic.org/en/7.1/contacts/manage_contacts.html
The primary JavaScript tracking method for Mautic. Insert this code before the closing