PHPackages                             dstockto/slartybartfast - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. dstockto/slartybartfast

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

dstockto/slartybartfast
=======================

Artifact build and deploy tool

V3.1(1y ago)67.9k↓50%1[2 issues](https://github.com/dstockto/slartybartfast/issues)MITPHPPHP ^8.1|^8.2

Since Jun 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dstockto/slartybartfast)[ Packagist](https://packagist.org/packages/dstockto/slartybartfast)[ RSS](/packages/dstockto-slartybartfast/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (24)Used By (0)

Slarty Bartfast V3.0
====================

[](#slarty-bartfast-v30)

Slarty Bartfast is an artifact manager to help simplify build and deploy processes dealing with "artifacts" and "assets".

What is an Artifact?
--------------------

[](#what-is-an-artifact)

An artifact is the result of a code change - meaning it could be a compiled executable, a zip file containing transpiled javascript or even just the contents of a project directory if that's what is needed to allow the application to run on a server. In short, an artifact ultimately ends up being a zip file containing code or binaries or a combination of those which can be used whenever we'd otherwise need to build an application.

What is an asset?
-----------------

[](#what-is-an-asset)

An asset is something your application needs in order to run, but it is not the result of your own code. It could be a third party library or other code or files that ideally don't change all that often. An example might be a version of the ExtJS framework. The application needs it to function, but it doesn't work with a normal package manager like npm or yarn. Slarty Bartfast allows these to be stored in the repository as a tar.gz file and then retrieved and deployed via the `slarty deploy-assets` command.

Why was Slarty Bartfast created?
--------------------------------

[](#why-was-slarty-bartfast-created)

At work, all of our projects use a "build" step for UI applications. These are typically React applications, but there's no reason this shouldn't work for any other application that takes a bunch of source code and creates a bundle or compiled artifact. Each of our applications consists of multiple separate UI applications. In some cases some applications may not be modified or updated for a long time, and any given PR (pull request) likely only updates a single application. It doesn't make sense ot rebuild applications that haven't changed. This also gives a nice way to ensure that the exact same build of an application is what we use in QA, UAT, Production and any other environment.

Integrating Slarty into our PR and build process means that we are saving a ton of time by not doing work we don't need to. Deployments that previously built on the server can now download and deploy artifacts in a few seconds as well.

What does Slarty Bartfast do?
-----------------------------

[](#what-does-slarty-bartfast-do)

Slarty Bartyfast uses git to uniquely identify the contents of directories. It currently will not work on non-git controlled code, but if that's important it may be a change in the future. The idea is that a project may contain several different applications or artifacts. Instead of building every sub-application every time there is a change or a pull request, if we can identify the contents that become or define a unique artifact, we can build it once and store it. Later on we can just download and use that artifact rather than recreating it.

By condensing the contents of a directory or directories down to a single unique value before building and using a predictable way to identify the resulting artifact file, we can quickly decide if a build is needed or if we've already built an artifact for this particular unique combination of code. Slarty Bartfast can, with the help of an `artifacts.json` configuration file, programmatically determine if a build is needed and kick it off if it is. Once it is done, it can store that artifact in a repository that it can later use to determine that it won't need to build again until the code is different.

Additionally, Slarty Bartfast can download and deploy those artifacts. Currently deployment is literally downloading and unzipping to the configured location. This download and unzipping process is very fast and saves a ton of time over building on the web server. It also means we don't need npm or node on the web server.

To summarize, Slarty Bartfast allows for repeatable, predictable deploys and eliminates the need to rebuild artifacts that have been built already.

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

[](#configuration)

Slarty Bartfast uses a json configuration file called `artifacts.json` by default. This file provides information that Slarty Bartfast uses to do its work. At the root, is an object with several keys. I'll talk about each of these sections and go into more detail where needed.

- **application** - The name of the application. This is not currently used
- **root\_directory** - The location of the root directory of the project. Everything Slarty Bartfast does will be relative to that directory. For convenience, you can use the "**DIR**" value to indicate that the root of the project is the same as the location of the artifacts.json file. Changing the root directory and the application's locations relative to that will result in a different identifier value and could result in different archive contents even if the actual source hasn't changed. It's highly recommended to put artifacts.json in the project's root directory and use `__DIR__`
- **repository** - This is the configuration for where build artifacts should be stored. It will be discussed in detail below.
- **artifacts** - This is where you configure each of the builds. More on this later as well.
- **assets** - This is where you configure assets for deployment. More on this later too.

### Configuration - "repository" section

[](#configuration---repository-section)

The "repository" section is where you configure the location where you'd like to store the results of building an artifact. It's where Slarty Bartfast will make the determination of if a build needs to be created, where to put the artifact and upon deployment, and where to pull artifacts for deployment.

Slarty Bartfast currently supports the local file system and Amazon's S3 as repository locations. The repository object requires an "adapter" key with either "local" or "s3" as the value. The value is case-insensitive. It also has an "options" key which is another object that defines the values we need in order to use the repository location.

#### Local Repository

[](#local-repository)

The local repository configuration is simplest. The only value needed in options is "root". Here's a sample local configuration:

```
{
  ...
  "repository": {
    "adapter": "Local",
    "options": {
      "root": "/tmp/artifact-repo"
    }
  },
  ...
}

```

#### S3 Repository

[](#s3-repository)

To use AWS S3 as a repository a few more options are required. Here's an example:

```
{
   ...
   "repository": {
    "adapter": "s3",
    "options": {
      "region": "us-east-1",
      "bucket-name": "",
      "path-prefix": "path/to/repo",
      "profile": "default (optional)"
    }
  },
  ...
}

```

Most of the values should be obvious what they are for. The path-prefix is the only optional value. If provided, it will result in the artifacts being placed in pseudo-directories on S3. It can be a good way to keep different applications' artifacts in the same bucket but keep them separated. You should have your AWS credentials in the `~/.aws/credentials` file of the user that will be running Slarty Bartfast. The profile key is optional and will default to "default", but if you would like Slarty to use credentials from a different profile section in your credentials file, this is where to put that.

### Configuration - "artifacts" section

[](#configuration---artifacts-section)

The artifacts section is an array of objects. Each of those objects defines the information needed to determine how to calculate the identifier, how to name the artifact, how to cause a build to happen and where to unzip an artifact to deploy.

An example:

```
{
      "name": "Models",
      "directories": ["src/SlartyBartfast/Model"],
      "command": "make Model",
      "output_directory": "src/SlartyBartfast/Model",
      "deploy_location": "build/murdles",
      "artifact_prefix": "slarty-models",
      "root": "optional/override"
    }

```

- **name** - The name of the artifact or build is used in the output of various Slarty Bartfast commands
- **directories** - Though the name is "directories" it will also work with individual files. These are used to determine the unique identifier. The idea is if anything in one or more of the directories has changed then the build output would be different. If files outside of these paths change and it causes different output from the build process, then those files or directories should be included in this array.
- **command** - This is the command that is executed to create the build output. It should be executable from the application's root directory
- **output\_directory** - This is the directory that will be zipped to form the archive file that will be stored in the repository
- **deploy\_location** - This is the location where the archive should be unzipped to
- **artifact\_prefix** - This value is used in part of the naming of the archive zip file. The archive name is essentially {archive\_prefix}-{hash}.zip. It helps identify what the artifact belong to or came from if looking on the file system.
- **root** - The root value at the artifact level is optional and you may never need to use it. By default, each artifact will use the root directory from the root of the configuration. If you need, for some reason, to calculate a hash from a different starting location for an application, you could provide that different root here. Again, in most cases you will not need this.

Configuration - "assets" section
--------------------------------

[](#configuration---assets-section)

The assets section is an array of objects. Each object defines the information needed to retrieve an asset from the artifact repository as well as where it should be unzipped to. At this time, the assets section only is used for the `deploy-assets` command. No other command uses or is aware of this section.

An example:

```
{
  "name": "ExtJS 4.2",
  "filename": "extjs-4.2.tar.gz",
  "deploy_location": "library/extjs-4.2"
}

```

- **name** - The name of the artifact is a friendly name that can be used to filter. You can limit the deploy-assets command to only deploying some assets by filtering on this name.
- **filename** - This is the name of the file that should be found in the artifact repository. At this time the file must exist in the same location as all the other artifacts.
- **deploy\_location** - This is the location where the asset will be downloaded and expanded. After expansion the asset archive itself will be removed.

Slarty Bartfast Commands
------------------------

[](#slarty-bartfast-commands)

Slarty Bartfast provides a number of commands. All are executed with ./slarty or /path/to/slarty.

### ./slarty hash &lt;root&gt; &lt;directories...&gt;

[](#slarty-hash-root-directories)

The hash command does not require artifacts config. The root value is where to start calculating the hash from and the directories are space separated relative paths to use when calculating the hash. The order of the provided directories will not affect the hash result.

```
➜  SlartyBartfast git:(master) ✗ ./slarty hash ~/Projects/myproject mydirectory

 c39bffc99a4277c31ad8185a8e2a0919bbe44a82

```

If the directories do not exist or are empty, you'll see an error. Please note: MacOSX does not use a case sensitive file system by default but git is case-sensitive. Please ensure the directories and configuration match the actual case of the files or directories.

### ./slarty artifact-names

[](#slarty-artifact-names)

The `artifact-names` command can accept \[-c|--config\] and \[-f|--filter\] options. Both are optional. If no configuration file is specified, it will default to ./artifacts.json. The filter option is used to provide a list of applications for which to provide artifact names. The result of this command is a table of applications paired with the artifact name for the current state of the repo:

```
➜  SlartyBartfast git:(master) ✗ ./slarty artifact-names
 ------------- --------------------------------------------------------------
  Application   Artifact Name
 ------------- --------------------------------------------------------------
  source        slarty-source-15ab98133cfacf640b76d7fdf7890211110e5041.zip
  Services      slarty-services-91f042b9df7c50b59ab08c657d09c81442e04a65.zip
  Models        slarty-models-51286ac4976b8dc1667d8f7bc033806e858cb7b7.zip
  AMess         slarty-mess-f2788bbe13c3240951a10d97593467a68502e2f7.zip
 ------------- --------------------------------------------------------------

```

### ./slarty hash-application

[](#slarty-hash-application)

Similarly to artifact-names, hash-application takes the same \[-c|--config\] and \[-f|--filter\] options. Instead of an artifact name, it provides the hashes alone.

```
➜  SlartyBartfast git:(master) ✗ ./slarty hash-application
 ------------- ------------------------------------------
  Application   Hash
 ------------- ------------------------------------------
  source        15ab98133cfacf640b76d7fdf7890211110e5041
  Services      91f042b9df7c50b59ab08c657d09c81442e04a65
  Models        51286ac4976b8dc1667d8f7bc033806e858cb7b7
  AMess         f2788bbe13c3240951a10d97593467a68502e2f7
 ------------- ------------------------------------------

```

### ./slarty should-build

[](#slarty-should-build)

The `should-build` command accepts the same options as most of the Slarty Bartfast commands - \[-c|--config\] and \[-f|--filter\]. The purpose of this command is to determine if the artifact archive exists in the repository. If it does exist then a build is not needed. If it does not, then a build would be needed. This command does that determination but without actually doing the builds.

```
➜  SlartyBartfast git:(master) ✗ ./slarty should-build
 ------------- --------------
  Application   Build Needed
 ------------- --------------
  source        YES
  Services      YES
  Models        NO
  AMess         NO
 ------------- --------------

```

In the example above, the artifacts for the `Models` and `AMess` applications already exist in the repository, but the builds for the `source` and `Services` applications do not exist in the repository.

### ./slarty do-builds

[](#slarty-do-builds)

The `do-builds` command, like most above also accepts the `[-c|--config]` and `[-f|--filter]`. It also accepts a `--force` option. Running `do-builds` will determine the name of the artifact that should result from a build. If it exists in the repo, then it will not be executed. If it does not exist, then the `command` part of the artifacts configuration will be executed. Once the build succeeds, the archive will be created by zipping the `output_directory` into an archive named like what you'd see in the `artifact-names` command. It then stores that archive in the repository.

If you provide the `--force` option, then it will not check if the archive exists in the repository. It will build and store the result in the repository which means if it did exist, it will be overwritten. If the build process changed but the code did not, this would be a good way to ensure that the proper artifact archive is what is stored in the repo.

```
Doing build for source - YES
Doing build for Services - YES
Doing build for Models - NO
Doing build for AMess - NO

Beginning build for source application
--------------------------------------

 Build succeeded for source
 1/2 [==============>-------------]  50%
-- Saved slarty-source-15ab98133cfacf640b76d7fdf7890211110e5041.zip to repository.

Beginning build for Services application
----------------------------------------

 2/2 [============================] 100%

```

If the `--force` option were provided in the example above, then all four builds would have executed and those artifacts would be stored in the repository.

### ./slarty do-deploys

[](#slarty-do-deploys)

Like most of the commands above, the `do-deploys` command accepts the `[-c|--config]` and `[-f|--fiter]` options. The purpose of the `do-deploys` command is to identify the archives that match the current repository's code state, download those from the repository, and unzip them into the `deploy_location` directory. If the archive cannot be found in the repository then it will be treated as a fatal error. This is to keep the steps of building and deploying strictly separated. Ideally, building happens on a Continuous Integration (CI) server while deployment would happen on the web or application server.

```
Found artifact slarty-source-15ab98133cfacf640b76d7fdf7890211110e5041.zip for source
 - Downloaded artifact
 - Unzipped artifact
 - Deleted (zip) artifact
Found artifact slarty-services-91f042b9df7c50b59ab08c657d09c81442e04a65.zip for Services
 - Downloaded artifact
 - Unzipped artifact
 - Deleted (zip) artifact
Found artifact slarty-models-51286ac4976b8dc1667d8f7bc033806e858cb7b7.zip for Models
 - Downloaded artifact
 - Unzipped artifact
 - Deleted (zip) artifact
Found artifact slarty-mess-f2788bbe13c3240951a10d97593467a68502e2f7.zip for AMess
 - Downloaded artifact
 - Unzipped artifact
 - Deleted (zip) artifact

```

The `do-deploy` process will create the directory structure specified in the `deploy_location` value. However, if that structure exists and contains files, it will not be cleared. That is a separate responsibility that should be taken care of elsewhere. The idea is that if an application needs to deploy several artifacts to the same place, it can do so. The unzipping command will overwrite any existing files that are in place when the deploy occurs. It will not remove any files that were already in place, so if a file existed in one deployment archive and then does not exist in the next, it would still exist in the deployment output directory.

### ./slarty deploy-assets

[](#slarty-deploy-assets)

The `deploy-assets` command accepts the `--filter` and `--config` options. They work the same as the other commands, except filter works on the name value in the config.

If you run `slarty deploy-assets` and Slarty is unable to find one of the referenced files in the artifact repository, the command will fail and tell you the asset that is missing. At this time, it does not "pre-check" for existence. It will work through the assets in order and it will fail on the first one that is missing. If it fails the return code of slarty will be non-zero.

The `deploy-assets` command will create the output directory path if it does not exist. It will be relative to the configured "root\_directory" configuration option at the root.

Why Slarty Bartfast?
--------------------

[](#why-slarty-bartfast)

The name of Slarty Bartfast comes from a character from The Hitchhiker's Guide to the Galaxy (HHGTTG). In the book, Slartibartfast works on the planet Magrathea, as a designer of custom planets. His favorite part of the job is designing coastlines and he won an award for the fjords in Norway. For Slartibartfast, planets are artifacts.

The name of the program went through a couple of ideas. The first two were "Artificer" and "Artifactory" but it turns out both of those are things that exist. Next was Slartibartifact which is fun to say but less fun to type as a command. Eventually I came back to "Slarty Bartfast" because of misremembering how to spell "Slartibartfast", but now it's totally on purpose because "./slarty" is simple enough and if this gets released, maybe searching for "Slarty Bartfast" will eventually get you to this program.

Full Example Configuration
--------------------------

[](#full-example-configuration)

Below is a full example config for an app that has two separate builds and artifacts and is using S3 as its storage location for artifact archives.

```
{
  "application": "Sample Application",
  "root_directory": "__DIR__",
    "repository": {
    "adapter": "s3",
    "options": {
      "key": "AKABAKWAMBALAMBADOOP",
      "secret": "I+Kn0wS0m3th1ngY0uD0n+tKN0W4Ab0UTtRY2GU355",
      "region": "us-east-1",
      "bucket-name": "example-app-artifacts",
      "path-prefix": "Example/App"
    }
  },

  "artifacts": [
    {
      "name": "Purple App",
      "directories": ["src/Purple"],
      "command": "make srcPurple",
      "output_directory": "build/purple",
      "deploy_location": "public/purple",
      "artifact_prefix": "purple-app"
    },
        {
      "name": "Green App",
      "directories": ["src/Green"],
      "command": "make srcGren",
      "output_directory": "build/green",
      "deploy_location": "public/green",
      "artifact_prefix": "green-app"
    },
  ],

  "assets": [
      {
        "name": "Some Asset",
        "filename": "smurpy.tar.gz",
        "deploy_location": "build/assets/smurpy"
      },
      {
        "name": "Legitimate Business",
        "filename": "opposite_of_murder-4.2.tar.gz",
        "deploy_location": "build/assets/unicorns"
      }
    ]
}

```

Local Mode
----------

[](#local-mode)

It is possible to use Slarty locally to run builds and test deployments. The `deploy-assets`, `do-builds`, `do-deploys`, and `should-build` commands all accept a `--local` flag which will act as though the artifacts.json has a repository adapter set to local. In order to help with this, I recommend you also include the repository-&gt;options-&gt;root value. The purpose of local mode is to allow for easier testing of builds and deployments without needing to change the artifacts.json file and then remember to not commit the changes to your source code repository.

Questions?
----------

[](#questions)

If there are any unanswered questions, problems, desired features, please contact , or feel free to open a pull request.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

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 ~72 days

Recently: every ~130 days

Total

22

Last Release

634d ago

Major Versions

V1.7 → V2.02022-04-13

V2.0.1 → V3.0.02022-10-09

v1.7.2 → V3.0.12023-03-13

V1.7.3 → V2.0.32023-03-13

V2.0.3 → V3.0.22023-03-13

PHP version history (7 changes)V0.1PHP &gt;7.2

V2.0PHP ^8.0

V3.0.0PHP ^8.1

v1.7.1PHP ^7.2|^8.0

v1.7.2PHP ^7.4|^8.0

V3.0.2PHP ^8.0|^8.1

V3.1PHP ^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/f76a6d43413d5dd84fa29c445dbe5abf708f8136c54534f046e905d97da1a3da?d=identicon)[dstockto](/maintainers/dstockto)

---

Top Contributors

[![dstockto](https://avatars.githubusercontent.com/u/775393?v=4)](https://github.com/dstockto "dstockto (10 commits)")[![billpottle](https://avatars.githubusercontent.com/u/49958404?v=4)](https://github.com/billpottle "billpottle (1 commits)")

---

Tags

deploybuildartifacts

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dstockto-slartybartfast/health.svg)

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

###  Alternatives

[banago/phploy

PHPloy - Incremental Git (S)FTP deployment tool that supports submodules, multiple servers and rollbacks.

1.4k47.2k](/packages/banago-phploy)[easycorp/easy-deploy-bundle

The easiest way to deploy Symfony applications

468310.2k](/packages/easycorp-easy-deploy-bundle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[ideato/idephix

PHP automation and deploy tool.

6533.1k](/packages/ideato-idephix)[kohkimakimoto/altax

Altax is an extensible deployment tool for PHP.

2002.8k](/packages/kohkimakimoto-altax)[rizeway/anchour

Toolkit for deploying web applications

265.7k](/packages/rizeway-anchour)

PHPackages © 2026

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