Understanding the Craft CMS eco system is important to fortrabbit. The "marketing team" requires a tool to analyze data about available Craft plugins. Your job is to deliver data for the marketing team.
- Create a stand-alone PHP CLI tool that provides a list of all composer packages of type
craft-plugin
. - Output the data as a table or to a
json
file, see definition below. - Create a GitHub repo that contains the code.
- Write a
README.md
that explains the tool.
- Query the
packagist.org
API to retrieve the data (follow the best practices when using the API). - When working with the data set, performance is more important than real time data.
- Skip abandoned packages.
- Skip packages without a
extra.handle
attribute. - Consider this tool NOT as a one-off-script, treat it as a piece of software that is maintained in the long run.
--limit (defaults to 50)
--orderBy (field, allowed values: downloads, favers, dependents, testLibrary, updated (defaults to downloads))
--order (ASC or DESC (defaults to DESC))
--output (path to the json file (if not set, table output to stdout is expected))
- The entire list of packages contains ~1.600 items
- Make use of PHP 8 language constructs if they make sense to you
- Make use of existing packages if they make sense to you
- There is probably more than one API call required to retrieve the data
- There is no knowledge about Craft CMS expected. In theory, analyzing other package types can make sense in the future.
- Defining the name of the tool is up to you
- Demonstrate best practices (e.g. OOP, tests, docs), but be pragmatic.
class CraftPluginPackage implements \JsonSerializable
{
public string $name;
public ?string $description;
public string $handle; // versions[0].extra.handle attribute
public string $repository;
public ?string $testLibrary; // detect the test library the package uses (e.g. phpunit/phpunit)
public string $version; // most recent branch
public int $downloads; // downloads.monthly
public int $dependents;
public int $favers;
public DateTime $updated;
}
See the schema to understand the handle
attribute: https://craftcms.com/docs/3.x/extend/plugin-guide.html#composer-json
- Don't register the package on packagist
- Don't create a
.phar
Provide instructions in the README.md about how to install the tool on a macos/linux system, assuming composer
and php
is available. You can expect some command line experience from the user. For convenience, the command should be executable from any location without specifying the path to the executable.
- Please complete within 7 days
- The task should not require more than 10 hours of focused work (take a break)
- Create an issues with this repo.
- Ask early if things are not clear
- Tell us if you are stuck, it's not a shame to ask for help
- Let us know when you are done
- We will review the code and have a chat about it - don't be afraid, it's just tech-talk