Download the PHP package godbout/alfred-workflow-config without Composer

On this page you can find all versions of the php package godbout/alfred-workflow-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package alfred-workflow-config

PHP Alfred Workflow Config

Latest Stable Version Build Status Quality Score Code Coverage Total Downloads

Easily read and write config settings for your Alfred 3 or 4 Workflow. We took care of the boring stuff for you.


Installation

Usage

Import the class:

Then you can start save settings. Use dot notation for nested settings:

Read settings:

You can provide a default config for your workflow. It will only be saved if no config is found:

Usage in your tests

Set the Alfred Workflow Data environment variable

The package uses an environment variable set by Alfred to determine where to create and store your data. If you are not using this Config class through a script that is called by Alfred (like in your tests, for example), then you need to set that environment variable. Use putenv("alfred_workflow_data=./where_you_want_to_store_alfred_data"); before writing or reading your settings.

Destroy the Config between tests

The Config class is a singleton. This allows me to provide you with a very simple and nice to use API. It works great when being used by Alfred calling your Workflow script, but not so much with testing. If you're using the Config class in your own tests, you have to destroy the singleton between each test. You can do it easily like this:

This will make sure that your next test starts with a virgin Config.

ArrayAccess

There is none. We don't keep an array of settings internally, so there's no way to implement completely ArrayAccess. You could read settings through an array notation but not add a new setting, so the whole ArrayAccess implementation has been put to sleep.

Behind the scenes

  1. We create the Alfred Workflow Data folder if it doesn't exist.
  2. We create a config.json file and store the settings, well, in pretty json.
  3. We directly read and write to the config file, so even if your workflow crashes after, your settings will be saved as soon as you call the method.

All versions of alfred-workflow-config with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2
adbario/php-dot-notation Version ^3.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package godbout/alfred-workflow-config contains the following files

Loading the files please wait ....