Download the PHP package brandon14/fossabot-commander without Composer

On this page you can find all versions of the php package brandon14/fossabot-commander. 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 fossabot-commander

Packagist PHP Version

GitHub Actions Workflow Status Code Climate maintainability Codecov GitHub

GitHub issues GitHub closed issues GitHub pull requests GitHub closed pull requests

GitHub release (with filter) GitHub commit activity (branch) GitHub last commit (by committer)

brandon14/fossabot-commander

Source code for brandon14/fossabot-commander

Table of Contents

  1. Requirements
  2. Purpose
  3. Installation
  4. Usage
  5. Standards
  6. Coverage
  7. Documentation
  8. Contributing
  9. Versioning
  10. Security Vulnerabilities

Requirements

Dependency Version
php ^7.4 || ^8.0
ext-json *
psr/http-factory ^1.0
psr/http-client ^1.0
psr/log ^1.0

Purpose

I built this library to aid in responding to Fossabot's customapi requests when using PHP. If you are running a webserver and want to send Fossabot customapi requests to that server, this package allows you to easily write commands and run them to return the text that would display in the chat message. The reason the commands return strings is because Fossabot Fossabot discards any status codes and other HTTP response content, and only uses the raw response body which is a string. This string can be JSON, text, etc.

The normal usage for Fossabot's customapi might be something like:

Set command !foo to $(customapi https://foo.bar/foo).

When someone types !foo in your chat, Fossabot will make a request to https://foo.bar/foo and whatever that URl returns will be used as the chat message. With this package, you can easily create commands, and invoke them via the FossabotCommander::runCommand() method, and use these utilties in you web framework of choice.

This library validates the Fossabot request using the request validation endpoint so you can be sure that the request came from Fossabot. You can also optionally (on by default) choose to get additional context about the request as outlined here to provide more rich integrations with Fossabot. The FossabotContext data will be passed into the command's getResponse method.

Installation

Usage

You will first need to get the custom API token from the request header. It will be in the x-fossabot-customapitoken header.

For a simple command (using Laravel as an example web framework):

You can also provide a callable to the runCommand() instead of an instance of a FossabotCommand provided the callable returns a string and takes an optional FossabotContext|null parameter.

This gives you an easier to implement method for quick commands that don't need a lot of external dependencies, or otherwise a more portable method to send Fossabot messages back.

The FossabotCommander class requires a PSR compliant ClientInterface and a PSR compliant RequestFactoryInterface. These can be provided by libraries like guzzlehttp/guzzle or other PSR compliant libraries. In the above example with Laravel we are assuming that the Laravel container has the FossabotCommander instance bound to the container.

For more complicated commands, the sky is the limit. Depending on how you want to build and instantiate your FossabotCommand instances, you can use the FossabotContext data to provide rich integration for your Fossabot chatbot!

Usage with Laravel:

If you are planning on using fossabot-commander in a Laravel project, check out the Laravel package fossabot-commander-laravel that I made for easy integration within the Laravel ecosystem.

Standards

We strive to meet the PSR-12 coding style for PHP projects, and enforce our coding standard via the php-cs-fixer linting tool. Our ruleset can be found in the .php-cs-fixer.dist.php file.

Coverage

The latest code coverage information can be found via Codecov. We strive to maintain 100% coverage across the entire library, so if you are contributing, please make sure to include tests for new code added.

Documentation

Documentation to this project can be found here.

Contributing

Got something you want to add? Found a bug or otherwise bad code? Feel free to submit pull requests to add in new features, fix bugs, or clean things up. Just be sure to follow the Code of Conduct and Contributing Guide, and we encourage creating clean and well described pull requests if possible.

If you notice an issues with the library or want to suggest new features, feel free to create issues appropriately using the issue tracker.

In order to run the tests, it is recommended that you sign up for a Cloudinary account (it's a free service), and use that account to run the full integration tests. In order to do that, you will need to copy .env.example to .env and fill in the variables using the details in your account. The integration tests will use random prefixed directories and clean everything up before and after the tests.

Versioning

brandon14/fossabot-commander uses semantic versioning that looks like MAJOR.MINOR.PATCH.

Major version changes will include backwards-incompatible changes and may require refactoring of projects using it. Minor version changes will include backwards-compatible new features and changes and will not break existing usages. Patch version changes will include backwards-compatible bug and security fixes, and should be updated as soon as possible.

Security Vulnerabilities

If you discover a vulnerability within this package, please email Brandon Clothier via [email protected]. All security vulnerabilities will be promptly addressed.

This code is released under the MIT license.

Copyright © 2023-2024 Brandon Clothier

X (formerly Twitter) Follow


All versions of fossabot-commander with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/log Version ^1.0 || ^2.0 || ^3.0
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 brandon14/fossabot-commander contains the following files

Loading the files please wait ....