PHPackages                             nyt/sugarcli-nyt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. nyt/sugarcli-nyt

AbandonedLibrary[CLI &amp; Console](/categories/cli)

nyt/sugarcli-nyt
================

SugarCli-NYT is a command line tool to install and manage SugarCRM installations with customizations for The New York Times.

v1.11.1(10y ago)16.3k[4 PRs](https://github.com/nytimes/sugarcli-nyt/pulls)Apache-2.0PHP &gt;=5.3.9

Since Nov 28Compare

[ Source](https://github.com/nytimes/sugarcli-nyt)[ Packagist](https://packagist.org/packages/nyt/sugarcli-nyt)[ RSS](/packages/nyt-sugarcli-nyt/feed)WikiDiscussions Synced 2w ago

READMEChangelog (1)Dependencies (18)Versions (38)Used By (0)

SugarCli
========

[](#sugarcli)

SugarCli is a command line tool to install and manage SugarCRM installations.

Installing
==========

[](#installing)

Get the phar archive at `http://apt.inetprocess.fr/pub/sugarcli.phar`. Allow the execution and run it.

```
wget 'http://apt.inetprocess.fr/pub/sugarcli.phar'
chmod +x ./sugarcli.phar
./sugarcli.phar

```

Or clone this git repository and use `./bin/sugarcli`.

Building
========

[](#building)

Clone the git repository and run `php -dphar.readonly=0 bin/compile`. It will build the `sugarcli.phar` at the top of the git project.

Configuration
=============

[](#configuration)

You can save some configurations options in different location. The latter one will override the previous one: `/etc/sugarclirc``$HOME/.sugarclirc``./.sugarclirc`

Command line parameters will override these configurations.

Example
-------

[](#example)

```
---
sugarcrm:
    path: path/to/sugar
    url: http://external.url
```

Usage
=====

[](#usage)

`./sugarcli.phar --help`: This will give you the help and list of available commands.

Development
===========

[](#development)

Run tests
---------

[](#run-tests)

Copy the file `phpunit.xml.dist` to `phpunit.xml` and edit the environment variables.

Run the full test suite with `bin/phpunit` or exclude groups to avoid required external resources `bin/phpunit --exclude-group inventory,sugarcrm-db`

**Available groups**:

- inventory
- sugarcrm-db
- sugarcrm-path
- sugarcrm-url

Commands
========

[](#commands)

- [Clean language files](#clean-language-files)
- [Install a SugarCRM](#install-a-sugarcrm)
- [Manage `fields_meta_data` and `relationships` tables](#manage-fields_meta_data-table)
- [Inventory](#inventory)
- [User Management](#user-management)
- [System](#system)
- [Logic Hooks](#logic-hooks)
- [Vardefs Extractor](#vardefs-extractor)
- [Code Generator](#code-generator)

Clean language files
--------------------

[](#clean-language-files)

The main command is `./sugarcli.phar clean:langfiles`

#### Parameters

[](#parameters)

```
--no-sort           Do not sort the files contents. It will still remove duplicates. Useful for testing.
-t, --test          Try to rewrite the files without modifying the contents. Imply --no-sort.
-p, --path=PATH     Path to SugarCRM installation.
```

#### Test run

[](#test-run)

`./sugarcli.phar clean:langfiles --test path/to/sugar`

This will parse the custom languages files from sugar. It should return the files as is.

### Clean without sorting.

[](#clean-without-sorting)

`./sugarcli.phar clean:langfiles --no-sort path/to/sugar`

This will clean the lang files by removing unecessary whitespaces and remove duplicates in variables definitions.

### Clean and sort

[](#clean-and-sort)

`./sugarcli.phar clean:langfiles path/to/sugar`

This will clean and sort the language files. All defined variables will be sorted by name.

Install a SugarCRM
------------------

[](#install-a-sugarcrm)

The main command is `./sugarcli.phar install`

Subcommands are :

```
./sugarcli.phar install:config:get
./sugarcli.phar install:check
./sugarcli.phar install:run
```

### Configure your installation

[](#configure-your-installation)

`./sugarcli.phar install:config:get` will create a `config_si.php` in the current directory.

This provides default settings for the installer. You will need to complete some require parameters like db information, usernames and passwords. Required fields are in the form ``.

#### `install:config:get` - Parameters

[](#installconfigget---parameters)

```
-c, --config=CONFIG   Write to this file instead of config_si.php. [default: "config_si.php"]
-f, --force           Overwrite existing file
```

#### `install:check` - Parameters

[](#installcheck---parameters)

```
-p, --path=PATH       Path to SugarCRM installation.
```

### Run the installer

[](#run-the-installer)

`./sugarcli.phar install:run [-f|--force] [-s|--source[="..."]] [-c|--config[="..."]] path url`

You need to specify an installation path and the public url for your sugar installation.

The installer will extract a SugarCRM installation package named sugar.zip or specified with the `--source` option.

It will use the `--config` option to use for the installation.

#### `install:run` - Parameters

[](#installrun---parameters)

```
-f, --force           Force installer to remove target directory if present.
-s, --source=SOURCE   Path to SugarCRM installation package. [default: "sugar.zip"]
-c, --config=CONFIG   PHP file to use as configuration for the installation. [default: "config_si.php"]
-p, --path=PATH       Path to SugarCRM installation.
```

### Examples

[](#examples)

```
./sugarcli.phar install:config:get
nano config_si.php
./sugarcli.phar install:run -v ~/www/sugar7 http://myserver.example.org/sugar7 --source ~/sugar_package/SugarPro-Full-7.2.2.1.zip
```

Use `-v` or `-vv` to add more verbose output.

Manage `fields_meta_data` and `relationships` tables
----------------------------------------------------

[](#manage-fields_meta_data-and-relationships-tables)

Two groups of commands are available to export and sync the content of the fields\_meta\_data table (custom fields from studio) and relationships (default and custom relationships).

The first has `metadata` as a prefix and the second has `rels`

By default the metadata definition file will be `/../db/fields_meta_data.yaml` and the relationships will be `/../db/relationships.yaml`.

You can override it with the `--metadata-file` parameter for all the `metadata` sub-commands and `--file` parameter for all the `rels` subcommands.

The main command are then `./sugarcli.phar metadata` and `./sugarcli.phar rels`

Subcommands are :

```
./sugarcli.phar metadata:loadfromfile
./sugarcli.phar metadata:dumptofile
./sugarcli.phar metadata:status

./sugarcli.phar rels:loadfromfile
./sugarcli.phar rels:dumptofile
./sugarcli.phar rels:status
```

The following explanations are made for `metadata` but are similar for `rels`

### Load definition to the database

[](#load-definition-to-the-database)

`sugarcli {type}:loadfromfile`Load fields defined in the meta data file to update the database.

#### `metadata:loadfromfile` Parameters

[](#metadataloadfromfile-parameters)

```
-s, --sql                          Print the sql queries that would have been executed.
-f, --force                        Really execute the SQL queries to modify the database.
-a, --add                          Add new fields from the file to the DB.
-d, --del                          Delete fields not present in the metadata file from the DB.
-u, --update                       Update the DB for modified fields in metadata file.
-p, --path=PATH                    Path to SugarCRM installation.
-m, --metadata-file=METADATA-FILE  Path to the metadata file. (default: "/../db/fields_meta_data.yaml")
```

#### `rels:loadfromfile` Parameters

[](#relsloadfromfile-parameters)

```
-s, --sql             Print the sql queries that would have been executed.
-f, --force           Really execute the SQL queries to modify the database.
-a, --add             Add new fields from the file to the DB.
-d, --del             Delete fields not present in the relationships file from the DB.
-u, --update          Update the DB for modified fields in relationships file.
-p, --path=PATH       Path to SugarCRM installation.
    --file=FILE       Path to the rels file. (default: "/../db/relationships.yaml")
```

### Write definition to a file

[](#write-definition-to-a-file)

`sugarcli {type}:dump`

You can dump the current DB fields\_meta\_data (or relationships) contents into the definition file.

You can also use the `--add`, `--del`, `--update` flags to only add, delete or update fields (or relationships).

The fields specified after the command line will allow you to act only on specific fields (or relationships).

#### `metadata:dumptofile` Parameters

[](#metadatadumptofile-parameters)

```
-a, --add                          Add new fields from the DB to the definition file.
-d, --del                          Delete fields not present in the DB from the metadata file.
-u, --update                       Update the metadata file for modified fields in the DB.
-p, --path=PATH                    Path to SugarCRM installation.
-m, --metadata-file=METADATA-FILE  Path to the metadata file. (default: "/../db/fields_meta_data.yaml")
```

#### `rels:dumptofile` Parameters

[](#relsdumptofile-parameters)

```
-a, --add             Add new relationships from the DB to the definition file.
-d, --del             Delete relationships not present in the DB
-u, --update          Update the relationships in the DB.
-p, --path=PATH       Path to SugarCRM installation.
    --file=FILE       Path to the rels file. (default: "/../db/relationships.yaml")
```

### Get the Status

[](#get-the-status)

`sugarcli {type}:status -p path/to/sugar`

This will show which fields are differing between the definition file and the database.

#### `metadata:status` Parameters

[](#metadatastatus-parameters)

```
-p, --path=PATH                    Path to SugarCRM installation.
-m, --metadata-file=METADATA-FILE  Path to the metadata file. (default: "/../db/fields_meta_data.yaml")
```

#### `rels:status` Parameters

[](#relsstatus-parameters)

```
-p, --path=PATH       Path to SugarCRM installation.
    --file=FILE       Path to the rels file. (default: "/../db/relationships.yaml")
```

Inventory
---------

[](#inventory)

The main command is `./sugarcli.phar inventory`

Subcommands are :

```
./sugarcli.phar inventory:facter
./sugarcli.phar inventory:agent
```

### Get Facts about your environment.

[](#get-facts-about-your-environment)

`./sugarcli.phar inventory:facter --path  --format yml` will give you a yaml file with various information about the system and the sugarcrm instance.

#### `inventory:facter` Parameters

[](#inventoryfacter-parameters)

```
-F, --custom-fact=CUSTOM-FACT  Add or override facts. Format: path.to.fact:value (multiple values allowed)
-f, --format=FORMAT            Specify the output format. (json|yml|xml). [default: "yml"]
-p, --path=PATH                Path to SugarCRM installation.
```

### Report information to an inventory server.

[](#report-information-to-an-inventory-server)

`./sugarcli.phar inventory:agent --path  --account-name 'Name of client'   `

This will send all the gathered facts to the inventory server.

#### `inventory:agent` Parameters

[](#inventoryagent-parameters)

```
-F, --custom-fact=CUSTOM-FACT    Add or override facts. Format: path.to.fact:value (multiple values allowed)
-p, --path=PATH                  Path to SugarCRM installation.
-a, --account-name=ACCOUNT-NAME  Name of the account.
```

User management
---------------

[](#user-management)

The main command is `./sugarcli.phar user`

Subcommands are :

```
./sugarcli.phar user:update
./sugarcli.phar user:create
./sugarcli.phar user:list
```

### Update a user

[](#update-a-user)

`./sugarcli.phar user:update --path  --first-name=Admin --last-name='Test' myNewLogin` will update the user myNewLogin and set the first and last name.

#### `user:update` Parameters

[](#userupdate-parameters)

```
-c, --create                 Create the user instead of updating it. Optional if called with users:create.
-f, --first-name=FIRST-NAME  First name of the user.
-l, --last-name=LAST-NAME    Last name of the user.
-P, --password=PASSWORD      Password of the user [UNSAFE].
    --ask-password           Ask for user password.
-a, --admin=ADMIN            Make the user administrator. [yes/no]
-A, --active=ACTIVE          Make the user active. [yes/no]
-p, --path=PATH              Path to SugarCRM installation.
```

### Create a new user

[](#create-a-new-user)

`./sugarcli.phar user:create --path  --password=mypasword --admin=yes myNewLogin` will create a new admin user with login myNewLogin and password mypasword.

#### `user:create` Parameters

[](#usercreate-parameters)

```
-c, --create                 Create the user instead of updating it. Optional if called with users:create.
-f, --first-name=FIRST-NAME  First name of the user.
-l, --last-name=LAST-NAME    Last name of the user.
-P, --password=PASSWORD      Password of the user [UNSAFE].
    --ask-password           Ask for user password.
-a, --admin=ADMIN            Make the user administrator. [yes/no]
-A, --active=ACTIVE          Make the user active. [yes/no]
-p, --path=PATH              Path to SugarCRM installation.
```

### List users of an instance.

[](#list-users-of-an-instance)

`./sugarcli.phar user:list --path ` will give you a nice output of the users.

You can also limit the result to a specific username (`--username`) and change the output format (`--format`) to json, yml or xml.

#### `user:list` Parameters

[](#userlist-parameters)

```
-u, --username=USERNAME  Login of the user.
-f, --format=FORMAT      Output format. (text|json|yml|xml) [default: "text"]
-F, --fields=FIELDS      List of comma separated field name. [default: "id,user_name,is_admin,status,first_name,last_name"]
-l, --lang=LANG          Lang for display. [default: "en_us"]
-p, --path=PATH          Path to SugarCRM installation.
```

System
------

[](#system)

The main command is `./sugarcli.phar system`

Subcommands are:

```
./sugarcli.phar system:quickrepair
```

### Do a Quick Repair &amp; Rebuild

[](#do-a-quick-repair--rebuild)

`./sugarcli.phar system:quickrepair --path ` will do a basic Quick Repair &amp; Rebuild of your SugarCRM instance.

You can also use `--database` to see if Vardefs are synchronized with the Database.

If they are not in sync you can run the queries by adding `--force`.

Finally, if you want to have the full output from SugarCRM, add the verbose (`--verbose`) option.

#### `system:quickrepair` Parameters

[](#systemquickrepair-parameters)

```
-d, --database        Manage database changes.
-f, --force           Really execute the SQL queries (displayed by using -v).
-p, --path=PATH       Path to SugarCRM installation.
```

#### Example:

[](#example-1)

The command `./sugarcli.phar system:quickrepair --database` has that type of output:

```
Reparation:
 - Repair Done.

Database Messages:
Database tables are synced with vardefs

```

Logic Hooks
-----------

[](#logic-hooks)

The main command is `./sugarcli.phar hooks`

Subcommands are:

```
./sugarcli.phar hooks:list
```

### List the existing logic hooks for a module

[](#list-the-existing-logic-hooks-for-a-module)

`./sugarcli.phar hooks:list --path  --module ` will generate of list of hooks for the specified module.

That command lists the hooks with, for each, its Weight, description, the file where the class is defined, the method called, and where it's defined.

You can also use `--compact` to have the basic informations about hooks (Weight / Description / Method).

#### Parameters

[](#parameters-1)

```
-m, --module=MODULE   Module's name.
    --compact         Activate compact mode
-p, --path=PATH       Path to SugarCRM installation.

```

#### Example

[](#example-2)

The command `./sugarcli.phar hooks:list --module Contacts --compact` gives that type of output, for a module with no Hooks:

```
+-----------+-------------+--------+
| Hooks definition for Contacts    |
+-----------+-------------+--------+
| Weight    | Description | Method |
+-----------+-------------+--------+
| No Hooks for that module         |
+-----------+-------------+--------+

```

Vardefs Extractor
-----------------

[](#vardefs-extractor)

### Extract fields and relationships for a module

[](#extract-fields-and-relationships-for-a-module)

`./sugarcli.phar extract:fields --path  --module ` will extract all the fields defined for a module, with theirs parameters (Label, content of dropdowns, dbType, etc ...) and write 2 csv files containing the data.

#### Parameters

[](#parameters-2)

```
-m, --module=MODULE   Module's name.
    --lang=LANG       SugarCRM Language [default: "fr_FR"]
-p, --path=PATH       Path to SugarCRM installation.

```

Code Generator
--------------

[](#code-generator)

The main command is `./sugarcli.phar code`

Subcommands are:

```
./sugarcli.phar code:execute:file
```

### Execute a php file from the SugarCRM context

[](#execute-a-php-file-from-the-sugarcrm-context)

`./sugracli.phar code:execute:file --path  [--user-id='1'] ` will execute the file `test.php` by loading first the sugarcrm environment. So the script can directly use the classes and db from sugar. You can also set the user\_id from the command line to have another one than the default administrator.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity70

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Total

33

Last Release

3725d ago

Major Versions

v0.1.0 → v1.0.02014-11-28

PHP version history (2 changes)v1.4.1PHP &gt;=5.3.3

v1.9.1PHP &gt;=5.3.9

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13838899?v=4)[Joe Cora](/maintainers/jcora-nyt)[@jcora-nyt](https://github.com/jcora-nyt)

---

Tags

sugarcrmsugarcli

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nyt-sugarcli-nyt/health.svg)

```
[![Health](https://phpackages.com/badges/nyt-sugarcli-nyt/health.svg)](https://phpackages.com/packages/nyt-sugarcli-nyt)
```

###  Alternatives

[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M668](/packages/shopware-core)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

55344.7k5](/packages/jolicode-castor)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M231](/packages/sulu-sulu)[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k17.0M1.1k](/packages/phpro-grumphp)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103574.3k68](/packages/friendsoftypo3-content-blocks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
