Langchainjs: Building Applications with LLMs Through Composability

🦜️🔗 LangChain.js

⚡ Building applications with LLMs through composability ⚡

Production Support: As you move your LangChains into production, we'd love to offer more comprehensive support. Please fill out this form and we'll set up a dedicated support Slack channel.

Quick Install

yarn add langchain

import { OpenAI } from "langchain/llms";

🤔 What is this?

Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not. But using these LLMs in isolation is often not enough to create a truly powerful app - the real power comes when you can combine them with other sources of computation or knowledge.

This library is aimed at assisting in the development of those types of applications.

Relationship with Python LangChain

This is built to integrate as seamlessly as possible with the LangChain Python package. Specifically, this means all objects (prompts, LLMs, chains, etc) are designed in a way where they can be serialized and shared between languages.

The LangChainHub is a central place for the serialized versions of these prompts, chains, and agents.

📖 Documentation

For full documentation of prompts, chains, agents and more, please see here.

💁 Contributing

As an open source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infra, or better documentation.

Check out our contributing guidelines for instructions on how to contribute.

Download Details:

Author: hwchase17
Source Code: 
License: MIT license

#typescript #applications #composer 

Langchainjs: Building Applications with LLMs Through Composability

Telegram-bot-sdk: Telegram Bot API PHP SDK

Telegram Bot API - PHP SDK

Telegram Bot PHP SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box.

Telegram Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.

To learn more about the Telegram Bot API, please consult the Introduction to Bots and Bot FAQ on official Telegram site.

To get started writing your bots using this SDK, Please refer the documentation.


Documentation for the SDK can be found on the website.

Are You Using Telegram Bot SDK?

If you're using this SDK to build your Telegram Bots, We'd love to know and share the bot with the world. Tell us about it - here

Check out the Who's Using Telegram Bot SDK wiki page to know more about what people have been building with this SDK.

Additional information

Any issues, feedback, suggestions or questions please use issue tracker here.


Thank you for considering contributing to the project. Please review the CONTRIBUTING guidelines before submitting any pull requests.



This project and its author is neither associated, nor affiliated with Telegram in anyway. See License section for more details.

Download Details:

Author: irazasyed
Source Code: 
License: BSD-3-Clause license

#bot #php #laravel #composer #sdk 

Telegram-bot-sdk: Telegram Bot API PHP SDK

Laravel-messenger: Simple User Messaging Package for Laravel

Laravel Messenger

This package will allow you to add a full user messaging system into your Laravel application.

Leave some feedback

How are you using laravel-messenger?


  • Multiple conversations per user
  • Optionally loop in additional users with each new message
  • View the last message for each thread available
  • Returns either all messages in the system, all messages associated to the user, or all message associated to the user with new/unread messages
  • Return the users unread message count easily
  • Very flexible usage so you can implement your own access control

Common uses

  • Open threads (everyone can see everything)
  • Group messaging (only participants can see their threads)
  • One to one messaging (private or direct thread)

Laravel Versions

5.0-5.4<= 2.16.2

Installation (Laravel 4.x - no longer actively supported)

Installation instructions for Laravel 4 can be found here.

Installation (Laravel 5.x)

composer require cmgmyr/messenger

Or place manually in composer.json:

"require": {
    "cmgmyr/messenger": "~2.0"


composer update

Add the service provider to config/app.php under providers:

'providers' => [

Note: If you are using Laravel 5.5, this step is unnecessary. Laravel Messenger supports Package Discovery.

Publish config:

php artisan vendor:publish --provider="Cmgmyr\Messenger\MessengerServiceProvider" --tag="config"

Update config file to reference your User Model:


Create a users table if you do not have one already. If you need one, the default Laravel migration will be satisfactory.

(Optional) Define names of database tables in package config file if you don't want to use default ones:

'messages_table' => 'messenger_messages',
'participants_table' => 'messenger_participants',
'threads_table' => 'messenger_threads',

Publish migrations:

php artisan vendor:publish --provider="Cmgmyr\Messenger\MessengerServiceProvider" --tag="migrations"

Migrate your database:

php artisan migrate

Add the trait to your user model:

use Cmgmyr\Messenger\Traits\Messagable;

class User extends Authenticatable {
    use Messagable;


Example Projects


Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.


Special Thanks

This package used AndreasHeiberg/laravel-messenger as a starting point.

Download Details:

Author: cmgmyr
Source Code: 
License: MIT license

#php #laravel #messenger #composer 

Laravel-messenger: Simple User Messaging Package for Laravel

GitHub Action to Set Up PHP with Extensions, Php.ini Configuration

Setup PHP in GitHub Actions

Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in GitHub Actions. This action gives you a cross-platform interface to set up the PHP environment you need to test your application. Refer to Usage section and examples to see how to use this.

☁️ OS/Platform Support

Both GitHub-hosted and self-hosted runners are supported by setup-php on the following OS/Platforms.

GitHub-Hosted Runners

Virtual environmentYAML workflow labelPre-installed PHP
Ubuntu 22.04ubuntu-22.04PHP 8.1
Ubuntu 20.04ubuntu-latest or ubuntu-20.04PHP 7.4 to PHP 8.1
Ubuntu 18.04ubuntu-18.04PHP 7.2 to PHP 8.1
Windows Server 2022windows-latest or windows-2022PHP 8.1
Windows Server 2019windows-2019PHP 8.1
macOS Monterey 12.xmacos-12PHP 8.1
macOS Big Sur 11.xmacos-latest or macos-11PHP 8.1
macOS Catalina 10.15macos-10.15PHP 8.1

Self-Hosted Runners

Host OS/Virtual environmentYAML workflow label
Ubuntu 22.04self-hosted or Linux
Ubuntu 20.04self-hosted or Linux
Ubuntu 18.04self-hosted or Linux
Debian 11self-hosted or Linux
Debian 10self-hosted or Linux
Windows 7 and newerself-hosted or Windows
Windows Server 2012 R2 and newerself-hosted or Windows
macOS Monterey 12.x x86_64/arm64self-hosted or macOS
macOS Big Sur 11.x x86_64/arm64self-hosted or macOS
macOS Catalina 10.15self-hosted or macOS
  • Refer to the self-hosted setup to use the action on self-hosted runners.
  • Operating systems based on the above Ubuntu and Debian versions are also supported on best effort basis.
  • If the requested PHP version is pre-installed, setup-php switches to it, otherwise it installs the PHP version.

🎉 PHP Support

On all supported OS/Platforms the following PHP versions are supported as per the runner.

  • PHP 5.3 to PHP 8.2 on GitHub-hosted runners.
  • PHP 5.6 to PHP 8.2 on self-hosted runners.
PHP VersionStabilityRelease SupportRunner Support
5.3StableEnd of lifeGitHub-hosted
5.4StableEnd of lifeGitHub-hosted
5.5StableEnd of lifeGitHub-hosted
5.6StableEnd of lifeGitHub-hosted, self-hosted
7.0StableEnd of lifeGitHub-hosted, self-hosted
7.1StableEnd of lifeGitHub-hosted, self-hosted
7.2StableEnd of lifeGitHub-hosted, self-hosted
7.3StableEnd of lifeGitHub-hosted, self-hosted
7.4StableSecurity fixes onlyGitHub-hosted, self-hosted
8.0StableActiveGitHub-hosted, self-hosted
8.1StableActiveGitHub-hosted, self-hosted
8.2NightlyIn developmentGitHub-hosted, self-hosted


  • Specifying 8.2 in php-version input installs a nightly build of PHP 8.2.0-dev. See nightly build setup for more information.
  • To use JIT on PHP 8.0 and above, refer to the JIT configuration section.

➕ PHP Extension Support

PHP extensions can be set up using the extensions input. It accepts a string in csv-format.

  • On Ubuntu, extensions which are available as a package, available on PECL or a git repository can be set up.
- name: Setup PHP with PECL extension
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    extensions: imagick, swoole

On Windows, extensions available on PECL which have the DLL binary can be set up.

On macOS, extensions available on PECL or a git repository can be set up.

On Ubuntu and macOS to compile and install an extension from a git repository follow this guide.

Extensions installed along with PHP if specified are enabled.

Specific versions of extensions available on PECL can be set up by suffixing the extension's name with the version. This is useful for installing old versions of extensions which support end of life PHP versions.

- name: Setup PHP with specific version of PECL extension
  uses: shivammathur/setup-php@v2
    php-version: '5.4'
    extensions: swoole-1.9.3
  • Extensions with pre-release versions available on PECL can be set up by suffixing the extension's name with its state i.e alpha, beta, devel or snapshot.
- name: Setup PHP with pre-release PECL extension
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    extensions: xdebug-beta

On Ubuntu and macOS to compile and install an extension from PECL with libraries or custom configuration follow this guide.

Shared extensions can be disabled by prefixing them with a :. All extensions depending on the specified extension will also be disabled.

- name: Setup PHP and disable opcache
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    extensions: :opcache
  • All shared extensions can be disabled by specifying none. When none is specified along with other extensions, it is hoisted to the start of the input. So, all the shared extensions will be disabled first, then rest of the extensions in the input will be processed.

Note: This disables all core and third-party shared extensions and thus, can break some tools which need them. Required extensions are enabled again when the tools are set up on a best-effort basis. So it is recommended to add the extensions required for your tools after none in the extensions input to avoid any issues.

- name: Setup PHP without any shared extensions except mbstring
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    extensions: none, mbstring
  • Extension intl can be set up with specific ICU version for PHP 5.6 and above in Ubuntu workflows by suffixing intl with the ICU version. ICU 50.2 and newer versions are supported. Refer to ICU builds for the specific versions supported.
- name: Setup PHP with intl
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    extensions: intl-70.1

Extensions loaded by default after setup-php runs can be found on the wiki.

These extensions have custom support:

  • cubrid, pdo_cubrid and gearman on Ubuntu.
  • geos and event on Ubuntu and macOS.
  • blackfire, couchbase, ioncube, oci8, pdo_firebird, pdo_oci, pecl_http, phalcon3, phalcon4 and phalcon5 on all supported OS.

By default, extensions which cannot be added or disabled gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set fail-fast flag to true.

- name: Setup PHP with fail-fast
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    extensions: oci8
    fail-fast: true

🔧 Tools Support

These tools can be set up globally using the tools input. It accepts a string in csv-format.

behat, blackfire, blackfire-player, churn, codeception, composer, composer-normalize, composer-prefetcher, composer-require-checker, composer-unused, cs2pr, deployer, flex, grpc_php_plugin, infection, parallel-lint, pecl, phan, phing, phinx, phive, php-config, php-cs-fixer, phpcbf, phpcpd, phpcs, phpdoc or phpDocumentor, phpize, phplint, phpmd, phpspec, phpstan, phpunit, phpunit-bridge, phpunit-polyfills, pint, prestissimo, protoc, psalm, rector, symfony or symfony-cli, vapor or vapor-cli, wp or wp-cli

- name: Setup PHP with tools
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: php-cs-fixer, phpunit
  • In addition to above tools any composer tool or package can also be set up globally by specifying it as vendor/package matching the listing on Packagist. This format accepts the same version constraints as composer.
- name: Setup PHP with tools
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: vimeo/psalm

To set up a particular version of a tool, specify it in the form tool:version.

Version can be in the following format:

  • Semver. For example tool:1.2.3 or tool:1.2.3-beta1.
  • Major version. For example tool:1 or tool:1.x.
  • Major and minor version. For example tool:1.2 or tool:1.2.x.
- name: Setup PHP with tools
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: php-cs-fixer:3.5, phpunit:9.5
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  • The latest stable version of composer is set up by default. You can set up the required composer version by specifying the major version v1 or v2, or the version in major.minor or semver format. Additionally for composer snapshot and preview can also be specified to set up the respective releases.
- name: Setup PHP with composer v2
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: composer:v2
  • If you do not use composer in your workflow, you can specify tools: none to skip it.
- name: Setup PHP without composer
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: none

Tools pear, pecl, phpize and php-config are set up by default for all supported PHP versions on Linux and macOS.

The latest version of blackfire cli is set up when blackfire is specified in tools input. Please refer to the official documentation for using blackfire with GitHub Actions.

Tools prestissimo and composer-prefetcher will be skipped unless composer:v1 is also specified in tools input. It is recommended to drop prestissimo and use composer v2.

By default, expect composer tools which cannot be set up gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set fail-fast flag to true.

- name: Setup PHP with fail-fast
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: deployer
    fail-fast: true


  • Input tools is useful to set up tools which are only used in CI workflows, thus keeping your composer.json tidy.
  • If you do not want to use all your dev-dependencies in workflow, you can run composer with --no-dev and install required tools using tools input to speed up your workflow.
  • By default, COMPOSER_NO_INTERACTION is set to 1 and COMPOSER_PROCESS_TIMEOUT is set to 0. In effect, this means that Composer commands in your scripts do not need to specify --no-interaction.
  • Also, COMPOSER_NO_AUDIT is set to 1. So if you want to audit your dependencies for security vulnerabilities, it is recommended to add a composer audit step before you install them.

📶 Coverage Support


Specify coverage: xdebug to use Xdebug and disable PCOV.
Runs on all PHP versions supported.

- name: Setup PHP with Xdebug
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    coverage: xdebug
  • When you specify coverage: xdebug, the latest version of Xdebug compatible with the PHP version is set up by default.
  • If you need Xdebug 2.x on PHP 7.2, 7.3 or 7.4, you can specify coverage: xdebug2.
- name: Setup PHP with Xdebug 2.x
  uses: shivammathur/setup-php@v2
    php-version: '7.4'
    coverage: xdebug2

Note: Xdebug is enabled by default on Ubuntu GitHub Actions images, so if you are not using it in your workflow it is recommended to disable it as that will have a positive impact on your PHP performance. Please refer to the disable coverage section for details.


Specify coverage: pcov to use PCOV and disable Xdebug.
Runs on PHP 7.1 and newer PHP versions.

  • If your source code directory is other than src, lib or, app, specify using the ini-values input.
- name: Setup PHP with PCOV
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    ini-values: #optional, see above for usage.
    coverage: pcov
  • PHPUnit 8.x and above supports PCOV out of the box.
  • If you are using PHPUnit 5.x, 6.x or 7.x, you need to set up pcov/clobber before executing your tests.
- name: Setup PCOV
  run: |
    composer require pcov/clobber
    vendor/bin/pcov clobber

Disable Coverage

Specify coverage: none to disable both Xdebug and PCOV.

Disable coverage for these reasons:

  • You are not generating coverage reports while testing.
  • You are using phpdbg for running your tests.
  • You are profiling your code using blackfire.
  • You are using PHP in JIT mode. Please refer to JIT configuration section for more details.
- name: Setup PHP with no coverage driver
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    coverage: none

📝 Usage


Specify using with keyword

php-version (required)

  • Specify the PHP version you want to set up.
  • Accepts a string. For example '8.0'.
  • Accepts latest to set up the latest stable PHP version.
  • Accepts nightly to set up a nightly build from the master branch of PHP.
  • Accepts the format d.x, where d is the major version. For example 5.x, 7.x and 8.x.
  • See PHP support for supported PHP versions.

extensions (optional)

  • Specify the extensions you want to add or disable.
  • Accepts a string in csv-format. For example mbstring, :opcache.
  • Accepts none to disable all shared extensions.
  • Shared extensions prefixed with : are disabled.
  • See PHP extension support for more info.

ini-file (optional)

  • Specify the base php.ini file.
  • Accepts production, development or none.
  • By default, production php.ini file is used.

ini-values (optional)

  • Specify the values you want to add to php.ini.
  • Accepts a string in csv-format. For example post_max_size=256M, max_execution_time=180.
  • Accepts ini values with commas if wrapped in quotes. For example xdebug.mode="develop,coverage".

coverage (optional)

  • Specify the code-coverage driver you want to set up.
  • Accepts xdebug, pcov or none.
  • See coverage support for more info.

tools (optional)

  • Specify the tools you want to set up.
  • Accepts a string in csv-format. For example: phpunit, phpcs
  • See tools support for tools supported.



On GitHub Actions you can assign the setup-php step an id, you can use the same to get the outputs in a later step.

  • Provides the PHP version in semver format.
- name: Setup PHP
  id: setup-php
  uses: shivammathur/setup-php@v2
    php-version: '8.1'

- name: Print PHP version
  run: echo ${{ steps.setup-php.outputs.php-version }}


Specify using env keyword

fail-fast (optional)

  • Specify to mark the workflow as failed if an extension or tool fails to set up.
  • This changes the default mode from graceful warnings to fail-fast.
  • By default, it is set to false.
  • Accepts true and false.

phpts (optional)

  • Specify to set up thread-safe version of PHP on Windows.
  • Accepts ts and nts.
  • By default, it is set to nts.
  • See thread safe setup for more info.

update (optional)

  • Specify to update PHP on the runner to the latest patch version.
  • Accepts true and false.
  • By default, it is set to false.
  • See force update setup for more info.

See below for more info.

Basic Setup

Set up a particular PHP version.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    extensions: mbstring, intl
    ini-values: post_max_size=256M, max_execution_time=180
    coverage: xdebug
    tools: php-cs-fixer, phpunit

Matrix Setup

Set up multiple PHP versions on multiple operating systems.

    runs-on: ${{ matrix.operating-system }}
        operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
        php-versions: ['7.4', '8.0', '8.1']
        phpunit-versions: ['latest']
        - operating-system: 'ubuntu-latest'
          php-versions: '7.2'
          phpunit-versions: '8.5.21'
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
        php-version: ${{ matrix.php-versions }}
        extensions: mbstring, intl
        ini-values: post_max_size=256M, max_execution_time=180
        coverage: xdebug
        tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}

Nightly Build Setup

Set up a nightly build of PHP 8.2.

  • This PHP version is currently in active development and might contain bugs and breaking changes.
  • Some user space extensions might not support this version currently.
- name: Setup nightly PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.2'
    extensions: mbstring
    ini-values: post_max_size=256M, max_execution_time=180
    coverage: xdebug
    tools: php-cs-fixer, phpunit

Debug Build Setup

Set up a PHP build with debugging symbols.

  • Production release builds of PHP without debugging symbols are set up by default.
  • You can use the debug environment variable to set up a build with debugging symbols for PHP 5.6 and above.
- name: Setup PHP with debugging symbols
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    debug: true # specify true or false

Thread Safe Setup

Set up TS or NTS PHP on Windows.

  • NTS versions are set up by default.
  • On Ubuntu and macOS only NTS versions are supported.
  • On Windows both TS and NTS versions are supported.
    runs-on: windows-latest
    name: Setup PHP TS on Windows
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
        php-version: '8.1'
        phpts: ts # specify ts or nts

Force Update Setup

Update to the latest patch of PHP versions.

  • Pre-installed PHP versions are not updated to their latest patch release by default.
  • If ppa:ondrej/php is missing on the Ubuntu GitHub environment, the PHP version is updated to the latest patch release.
  • You can specify the update environment variable to true for updating to the latest release.
- name: Setup PHP with latest versions
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    update: true # specify true or false

Verbose Setup

Debug your workflow

To debug any issues, you can use the verbose tag instead of v2.

- name: Setup PHP with logs
  uses: shivammathur/setup-php@verbose
    php-version: '8.1'

Multi-Arch Setup

Set up PHP on multiple architecture on Ubuntu GitHub Runners.

  • PHP 5.6 to PHP 8.1 are supported by setup-php on multiple architecture on Ubuntu.
  • For this, you can use shivammathur/node images as containers. These have compatible Nodejs installed for setup-php.
  • Currently, for ARM based setup, you will need self-hosted runners.
    runs-on: ubuntu-latest
    container: shivammathur/node:latest-${{ matrix.arch }}
        arch: ["amd64", "i386"]
      - name: Install PHP
        uses: shivammathur/setup-php@v2
          php-version: '8.1'

Self Hosted Setup

Set up PHP on a self-hosted runner.

To set up a containerised self-hosted runner, refer to the following guides as per your base operating system.

To set up the runner directly on the host OS or in a virtual machine, follow this requirements guide before setting up the self-hosted runner.

If your workflow uses service containers, then set up the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.

It is recommended to specify the environment variable runner with the value self-hosted for self-hosted environments.

    runs-on: self-hosted
        php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
    name: PHP ${{ matrix.php-versions }}
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
        php-version: ${{ matrix.php-versions }}
        runner: self-hosted


  • Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
  • Do not set up self-hosted runners on the side on your development environment or your production server.
  • Avoid using the same labels for your self-hosted runners which are used by GitHub-hosted runners.

Local Testing Setup

Test your Ubuntu workflow locally using nektos/act.

    runs-on: ubuntu-latest
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
        php-version: '8.1'

Run the workflow locally with act using shivammathur/node docker images.

Choose the image tag which matches the runs-on property in your workflow. For example, if you are using ubuntu-20.04 in your workflow, run act -P ubuntu-20.04=shivammathur/node:2004.

# For runs-on: ubuntu-latest
act -P ubuntu-latest=shivammathur/node:latest

# For runs-on: ubuntu-22.04
act -P ubuntu-22.04=shivammathur/node:2204

# For runs-on: ubuntu-20.04
act -P ubuntu-20.04=shivammathur/node:2004

# For runs-on: ubuntu-18.04
act -P ubuntu-18.04=shivammathur/node:1804

JIT Configuration

Enable Just-in-time (JIT) on PHP 8.0 and above.

  • To enable JIT, enable opcache in cli mode by setting opcache.enable_cli=1.
  • JIT conflicts with Xdebug, PCOV, and other extensions which override zend_execute_ex function, so set coverage: none and disable any such extension if added.
  • By default, opcache.jit=1235 and opcache.jit_buffer_size=256M are set which can be changed using ini-values input.
  • For detailed information about JIT related directives refer to the official PHP documentation.

For example to enable JIT in tracing mode with buffer size of 64 MB.

- name: Setup PHP with JIT in tracing mode
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    coverage: none
    ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M

Cache Extensions

You can cache PHP extensions using shivammathur/cache-extensions and action/cache GitHub Actions. Extensions which take very long to set up when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
Refer to shivammathur/cache-extensions for details.

Cache Composer Dependencies

If your project uses composer, you can persist the composer's internal cache directory. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.

- name: Get composer cache directory
  id: composer-cache
  run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
  uses: actions/cache@v2
    path: ${{ steps.composer-cache.outputs.dir }}
    key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
    restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
  run: composer install --prefer-dist


  • Please do not cache vendor directory using action/cache as that will have side effects.
  • If you do not commit composer.lock, you can use the hash of composer.json as the key for your cache.
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
  • If you support a range of composer dependencies and use prefer-lowest and prefer-stable options, you can store them in your matrix and add them to the keys.
key: ${{ runner.os }}-composer-${{ matrix.prefer }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-

GitHub Composer Authentication

If you have a number of workflows which set up multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. Also, if you specify only the major version or the version in major.minor format, you can hit the rate limit. To avoid this you can specify an OAuth token by setting GITHUB_TOKEN environment variable. You can use GITHUB_TOKEN secret for this purpose.

The COMPOSER_TOKEN environment variable has been deprecated in favor of GITHUB_TOKEN and will be removed in the next major version.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Private Packagist Authentication

If you use Private Packagist for your private composer dependencies, you can set the PACKAGIST_TOKEN environment variable to authenticate.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.1'

Manual Composer Authentication

In addition to GitHub or Private Packagist, if you want to authenticate private repositories hosted elsewhere, you can set the COMPOSER_AUTH_JSON environment variable with the authentication methods and the credentials in json format. Please refer to the authentication section in composer documentation for more details.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
        "http-basic": {
          "": {
            "username": "${{ secrets.EXAMPLE_ORG_USERNAME }}",
            "password": "${{ secrets.EXAMPLE_ORG_PASSWORD }}"

Inline PHP Scripts

If you have to run multiple lines of PHP code in your workflow, you can do that easily without saving it to a file.

Put the code in the run property of a step and specify the shell as php {0}.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.1'

- name: Run PHP code
  shell: php {0}
  run: |
    $welcome = "Hello, world";
    echo $welcome;

Problem Matchers

Problem matchers are json configurations which identify errors and warnings in your logs and surface them prominently in the GitHub Actions UI by highlighting them and creating code annotations.


Setup problem matchers for your PHP output by adding this step after the setup-php step.

- name: Setup problem matchers for PHP
  run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"


Setup problem matchers for your PHPUnit output by adding this step after the setup-php step.

- name: Setup problem matchers for PHPUnit
  run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"


PHPStan supports error reporting in GitHub Actions, so it does not require problem matchers.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: phpstan

- name: Run PHPStan
  run: phpstan analyse src


Psalm supports error reporting in GitHub Actions with an output format github.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: psalm

- name: Run Psalm
  run: psalm --output-format=github

Tools with checkstyle support

For tools that support checkstyle reporting like phpstan, psalm, php-cs-fixer and phpcs you can use cs2pr to annotate your code.
For examples refer to cs2pr documentation.

Here is an example with phpcs.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
    php-version: '8.1'
    tools: cs2pr, phpcs

- name: Run phpcs
  run: phpcs -q --report=checkstyle src | cs2pr


Examples of using setup-php with various PHP frameworks and packages.

Framework/PackageRuns onWorkflow
BlackfiremacOS, ubuntu and windowsblackfire.yml
Blackfire PlayermacOS, ubuntu and windowsblackfire-player.yml
CakePHP with MySQL and Redisubuntucakephp-mysql.yml
CakePHP with PostgreSQL and Redisubuntucakephp-postgres.yml
CakePHP without servicesmacOS, ubuntu and windowscakephp.yml
CodeIgnitermacOS, ubuntu and windowscodeigniter.yml
Laminas MVCmacOS, ubuntu and windowslaminas-mvc.yml
Laravel with MySQL and Redisubuntularavel-mysql.yml
Laravel with PostgreSQL and Redisubuntularavel-postgres.yml
Laravel without servicesmacOS, ubuntu and windowslaravel.yml
Lumen with MySQL and Redisubuntulumen-mysql.yml
Lumen with PostgreSQL and Redisubuntulumen-postgres.yml
Lumen without servicesmacOS, ubuntu and windowslumen.yml
Phalcon with MySQLubuntuphalcon-mysql.yml
Phalcon with PostgreSQLubuntuphalcon-postgres.yml
Slim FrameworkmacOS, ubuntu and windowsslim-framework.yml
Symfony with MySQLubuntusymfony-mysql.yml
Symfony with PostgreSQLubuntusymfony-postgres.yml
Symfony without servicesmacOS, ubuntu and windowssymfony.yml
Yii2 Starter Kit with MySQLubuntuyii2-mysql.yml
Yii2 Starter Kit with PostgreSQLubuntuyii2-postgres.yml

🔖 Versioning

  • Use the v2 tag as setup-php version. It is a rolling tag and is synced with the latest minor and patch releases. With v2 you automatically get the bug fixes, security patches, new features and support for latest PHP releases.
  • Semantic release versions can also be used. It is recommended to use dependabot with semantic versioning to keep the actions in your workflows up to date.
  • Commit SHA can also be used, but are not recommended. They have to be updated with every release manually, without which you will not get any bug fixes, security patches or new features.
  • For debugging any issues verbose tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
  • It is highly discouraged to use the master branch as version, it might break your workflow after major releases as they have breaking changes.
  • If you are using the v1 tag or a 1.x.y version, you should switch to v2 as v1 only gets critical bug fixes. Maintenance support for v1 will be dropped with the last PHP 8.0 release.

📦 Dependencies

📑 Further Reading

Download Details:

Author: Shivammathur
Source Code:
License: MIT license

#php #composer #tools 

GitHub Action to Set Up PHP with Extensions, Php.ini Configuration

Security Advisories As A Simple Composer Exclusion List, Updated Daily


This package ensures that your application doesn't have installed dependencies with known security vulnerabilities.


composer require --dev roave/security-advisories:dev-latest


This package does not provide any API or usable classes: its only purpose is to prevent installation of software with known and documented security issues. Simply add "roave/security-advisories": "dev-latest" to your composer.json "require-dev" section and you will not be able to harm yourself with software with known security vulnerabilities.

For example, try following:

composer require --dev roave/security-advisories:dev-latest
# following commands will fail:
composer require symfony/symfony:2.5.2
composer require zendframework/zendframework:2.3.1 

The checks are only executed when adding a new dependency via composer require or when running composer update: deploying an application with a valid composer.lock and via composer install won't trigger any security versions checking.

You can manually trigger a version check by using the --dry-run switch on an update while not doing anything. Running composer update --dry-run roave/security-advisories is an effective way to manually trigger a security version check.

roave/security-advisories for enterprise

Available as part of the Tidelift Subscription.

The maintainers of roave/security-advisories and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

You can also contact us at for looking into security issues in your own project.


This package can only be required in its dev-latest version: there will never be stable/tagged versions because of the nature of the problem being targeted. Security issues are in fact a moving target, and locking your project to a specific tagged version of the package would not make any sense.

This package is therefore only suited for installation in the root of your deployable project.


This package extracts information about existing security issues in various composer projects from the FriendsOfPHP/security-advisories repository and the GitHub Advisory Database.

Download Details:

Author: Roave
Source Code: 
License: MIT license

#php #composer #infosec #security

Security Advisories As A Simple Composer Exclusion List, Updated Daily

Grumphp: A PHP Code-quality tool


Sick and tired of defending code quality over and over again? GrumPHP will do it for you! This composer plugin will register some git hooks in your package repository. When somebody commits changes, GrumPHP will run some tests on the committed code. If the tests fail, you won't be able to commit your changes. This handy tool will not only improve your codebase, it will also teach your co-workers to write better code following the best practices you've determined as a team.

GrumPHP has a set of common tasks built-in. You will be able to use GrumPHP with a minimum of configuration.

We don't want to bore you with all the details, so quick: install it yourself and unleash the power of GrumPHP!




In order for this package to work, you have to make sure following tools are discoverable on the command-line:

  • php
  • composer
  • git

This package is a composer plugin and should be installed to your project's dev dependency using composer:

Install GrumPHP as a phar without dependencies:

composer require --dev phpro/grumphp-shim

Install GrumPHP with dependencies:

composer require --dev phpro/grumphp

Install GrumPHP without dependencies and automated git hooks through phive

phive install grumphp

When the package is installed, GrumPHP will attach itself to the git hooks of your project. You will see following message in the composer logs:

Watch out! GrumPHP is sniffing your commits!

GrumPHP will never push you into using a specific task. You can choose the tasks that fit your needs, and activate or deactivate any task in no time! See the suggest section in composer.json.

Note: GrumPHP will overwrite existing hooks unless you run composer install with --no-plugins or --no-scripts. We do create a backup of your git hook, but it's best to make sure you also have a backup of your custom hooks before you try to install GrumPHP.

Having trouble installing GrumPHP? Find out how to:


Some things in GrumPHP can be configured in a grumphp.yml or grumphp.yml.dist file in the root of your project (the directory where you run the grumphp command). You can specify a custom config filename and location in composer.json or in the --config option of the console commands.

# grumphp.yml
    hooks_dir: ~
    hooks_preset: local
         VAGRANT_HOST_DIR: .
         VAGRANT_PROJECT_DIR: /var/www
         ENV: {}
    stop_on_failure: false
    ignore_unstaged_changes: false
    hide_circumvention_tip: false
    process_timeout: 60
        failed: grumphp-grumpy.txt
        succeeded: grumphp-happy.txt
        enabled: true
        max_workers: 32
        enabled: true
        fix_by_default: false
        files: []
        variables: {}
        paths: []
    tasks: {}
    testsuites: []
    extensions: []

Details of the configuration are broken down into the following sections.


Since GrumPHP is just a CLI tool, these commands can be triggered:


GrumPHP works with PHP 5.6 or above.

This package has been tested with following git clients:

  • CLI Unix
  • CLI Mac
  • CLI Windows
  • PhpStorm Git
  • Atlassian SourceTree
  • Syntevo SmartGit


Lots of tasks are already available to make sure your team writes great code. We are always looking to support new tasks. Feel free to log an issue or create a pull request for a task we forgot.

Are you missing a feature or did you find a bug? Log it in the issue tracker! Want to help out? Feel free to contact us!



Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub. Please take a look at our rules before contributing your code.

Download Details:

Author: phpro
Source Code: 
License: MIT license

#php #composer #plugin #hacktoberfest 

Grumphp: A PHP Code-quality tool

The Lightweight PHP Database Framework to Accelerate The Development


The lightweight PHP database framework to accelerate development


Lightweight - Portable with only one file.

Easy - Easy to learn and use, friendly construction.

Powerful - Supports various common and complex SQL queries, data mapping and prevents SQL injection.

Compatible - Supports MySQL, MSSQL, SQLite, MariaDB, PostgreSQL, Sybase, Oracle, and more.

Friendly - Works well with every PHP framework, like Laravel, Codeigniter, Yii, Slim, and frameworks that are supporting singleton extension or composer.

Free - Under the MIT license, you can use it anywhere, whatever you want.


PHP 7.3+ and installed PDO extension.

Get Started

Install via composer

Add Medoo to the composer.json configuration file.

$ composer require catfan/medoo

And update the composer

$ composer update
// Require Composer's autoloader.
require 'vendor/autoload.php';

// Using Medoo namespace.
use Medoo\Medoo;

// Connect the database.
$database = new Medoo([
    'type' => 'mysql',
    'host' => 'localhost',
    'database' => 'name',
    'username' => 'your_username',
    'password' => 'your_password'

$database->insert('account', [
    'user_name' => 'foo',
    'email' => ''

$data = $database->select('account', [
], [
    'user_id' => 50

echo json_encode($data);

// [{
//    "user_name" : "foo",
//    "email" : "",
// }]

Contribution Guides

For starting a new pull request, please make sure it's compatible with other databases and write a unit test as possible.

Run phpunit tests for unit testing and php-cs-fixer fix for fixing code style.

Each commit should start with [fix], [feature] or [update] tag to indicate the change.

Please keep it simple and keep it clear.


Official website:



Open Collective:

Download Details:

Author: Catfan
Source Code: 
License: MIT license

#php #mysql #composer #database 

The Lightweight PHP Database Framework to Accelerate The Development

Bedrock: WordPress Boilerplate with Composer, Easier Configuration


A modern WordPress stack


Bedrock is a modern WordPress stack that helps you get started with the best development tools and project structure.

Much of the philosophy behind Bedrock is inspired by the Twelve-Factor App methodology including the WordPress specific version.


  • Better folder structure
  • Dependency management with Composer
  • Easy WordPress configuration with environment specific files
  • Environment variables with Dotenv
  • Autoloader for mu-plugins (use regular plugins as mu-plugins)
  • Enhanced security (separated web root and secure passwords with wp-password-bcrypt)



Create a new project:

$ composer create-project roots/bedrock

By default, this installs the dist version of all dependent packages. To install the source versions instead, update composer.json as follows:

 "preferred-install": {
   "roots/wordpress-no-content": "dist",
   "*": "source"

Update environment variables in the .env file. Wrap values that may contain non-alphanumeric characters with quotes, or they may be incorrectly parsed.

  • Database variables
    • DB_NAME - Database name
    • DB_USER - Database user
    • DB_PASSWORD - Database password
    • DB_HOST - Database host
    • Optionally, you can define DATABASE_URL for using a DSN instead of using the variables above (e.g. mysql://user:password@
  • WP_ENV - Set to environment (development, staging, production)
  • WP_HOME - Full URL to WordPress home (
  • WP_SITEURL - Full URL to WordPress including subdirectory (
  1. Add theme(s) in web/app/themes/ as you would for a normal WordPress site
  2. Set the document root on your webserver to Bedrock's web folder: /path/to/site/web/
  3. Access WordPress admin at


Keep track of development and community news.

Download Details:

Author: Roots
Source Code: 
License: MIT license

#php #wordpress #composer 

Bedrock: WordPress Boilerplate with Composer, Easier Configuration

Composer: Dependency Manager for PHP

Composer - Dependency Management for PHP

Composer helps you declare, manage, and install dependencies of PHP projects.

See for more information and documentation.

Installation / Usage

Download and install Composer by following the official instructions.

For usage, see the documentation.


Find public packages on

For private package hosting take a look at Private Packagist.


Follow @packagist or @seldaek on Twitter for announcements, or check the #composerphp hashtag.

For support, Stack Overflow offers a good collection of Composer related questions, or you can use the GitHub discussions.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project and its community you agree to abide by those terms.


Latest Composer

PHP 7.2.5 or above for the latest version.

Composer 2.2 LTS (Long Term Support)

PHP versions 5.3.2 - 8.1 are still supported via the LTS releases of Composer (2.2.x). If you run the installer or the self-update command the appropriate Composer version for your PHP should be automatically selected.


See also the list of contributors who participated in this project.

Security Reports

Please send any sensitive issue to Thanks!

Download Details:

Author: Composer
Source Code: 
License: MIT license

#php #composer #dependency 

Composer: Dependency Manager for PHP
Rupert  Beatty

Rupert Beatty


Coastercms: The Repository for Coaster CMS (


The repository for Coaster CMS ( a Laravel based Content Management System with advanced features and Physical Web integration.


We aim to make Coaster CMS as feature rich as possible. Built upon the Laravel PHP framework, Coaster CMS is both fast and secure. Create beautiful content with TinyMCE and take a look into the future with the Internet Of Things.

  • Built with Laravel 8 (v8)
  • Responsive file manager
  • WYSIWYG editor
  • Block based templating system
  • Beacon support

Quick Start

To get up and running with Coaster CMS as quickly as possible you can use Laravel's built-in php artisan serve command. Simply run the following command from your project's directory:

php artisan serve 

This will take care of the web server side of things, but you'll still need to install and configure a local MySQL database.


(This installation assumes you have nginx/apache, php and MySQL already installed)

Install Coaster CMS using composer: Get composer:

Run the following:

composer create-project coastercms/coastercms [project-name] 

Set up a MySQL database to host your content

Make sure the following folders/file are/is writable:




Then follow the simple instructions in the install script.

For more details go to

Add to an Existing Project

If you'd rather add Coaster CMS to an existing Laravel (v8) project, follow the steps through below:

  1. Go to the root directory of your project
  2. Run composer require coastercms/framework:~8.0 to install package
  3. Run php artisan coaster:update-assets to download admin assets
  4. Add the provider CoasterCms\Providers\CoasterRoutesProvider::class to your config/app.php file (near end as it registers a catch-all route)
  5. Go to a web browser and follow the install script that should have appeared
  6. Upload or create a theme

Download Details:

Author: CoasterCms
Source Code: 
License: GPL-3.0 license

#laravel #php #composer 

Coastercms: The Repository for Coaster CMS (
Rupert  Beatty

Rupert Beatty


SleepingOwlAdmin: Administrative interface Builder for Laravel

Laravel Admin Panel    

SleepingOwl Admin is an administrative interface builder for Laravel.

Install ver 8.* (last Released)

Install SleepingOwl Admin

composer require laravelrus/sleepingowl:8.*

Install ver 7.*

Install SleepingOwl Admin

composer require laravelrus/sleepingowl:7.*


If you upgrade the old version change in composer.json

"laravelrus/sleepingowl": "^7.*"

after run composer update laravelrus/sleepingowl

and run php artisan sleepingowl:update for update assets

Run this command in the terminal (if you want to know more about what exactly this command does, see install command documentation):

php artisan sleepingowl:install


By default, admin module uses Laravel authentication.

If you want to use auth, you can run artisan command php artisan make:auth ( and append middleware auth to config/sleeping_owl.php

'middleware' => ['web', 'auth']

Setting up middleware

By default auth middleware use default guard, selected in config/auth.php

'defaults' => [
  'guard' => 'web', <- default

If you are using some package for ACL like (Laratrust, Zizaco Entrust, etc...)

'middleware' => ['web', 'role:admin'],


'middleware' => ['web', 'permission:admin'],


  • Laravel > 5.5 - 5.8 (PHP < 7.1.3)
  • Laravel 6.* (PHP >= 7.2)
  • Laravel 7.* (PHP >= 7.2.5)
  • Laravel 8.* (PHP >= 7.3)
  • Laravel 9.* (PHP >= 8.0)

Lumen is NOT supported(((

Documentation new ver.9

Powered by Laravel 5.5 - 9+. (latest tested version 9.14.1)

Russian (90% process)

English (30% process)

Docs Github

Download Details:

Author: LaravelRUS
Source Code: 
License: MIT license

#laravel #composer #crud 

SleepingOwlAdmin: Administrative interface Builder for Laravel
Rupert  Beatty

Rupert Beatty


Cachet: an Open Source Status Page System for Everyone


Cachet is a beautiful and powerful open source status page system, a free replacement to services such as, and others.


Show your support

Cachet is a BSD-3-licensed open source project. If you'd like to support future development, check out the Patreon campaign.


  • List your services components
  • Log incidents
  • Apply custom CSS to the status page
  • Markdown support for incident messages
  • Translated into eleven languages
  • Metrics
  • Cross-database support: MySQL, PostgreSQL and SQLite
  • Subscriber notifications via Email
  • Two factor authentication, with Google Authenticator

Usage in production

Use of master in a production environment is not recommended as it may change at any time.


  • PHP 5.5.9+ or newer
  • Apache or Nginx server
  • Composer

How to contribute

We're always looking for contributions that improve Cachet. It's easy to get started and you don't even need to know how to write a single line of code!

Contributing as a non-developer/non-designer

We're always looking for new translations.

Of course bug reports, feature requests and documentation are always appreciated.

Contributing as a designer

As Cachet gains new features, the design and ideas that were once a perfect fit need updating and in some cases designing from scratch. This is where you come in! Fancy giving Cachet a lick of paint? Sweet!

You'll need to install Node.js, Bower and Gulp.

To get started you can do the following:

  1. Install Node.js and our dev dependencies.
  2. Make your changes to the SCSS files in ./resources/assets/sass/
  3. Run gulp

If you're making a lot of changes, you'll find that running gulp watch will make life easier for you!

Contributing as a developer

Built using Laravel.

We use these extra dependencies to develop Cachet:

  • Node.js
  • Gulp
  • Git

Once cloned to your local machine, you'll need some demo data! Run php artisan cachet:seed to get the demo installation on the go.

Installation, Upgrades and Documentation

You can now find our documentation at

Demo Account

To test out the demo, you may login to the Dashboard with the following:

The demo is reset every half hour.

Release Notes

We list releases on the Releases page of the Cachet GitHub repository. On the Releases page, you can also find the release notes for each release.


A special thank you to our translators, who have allowed us to share Cachet with the world. If you'd like to contribute translations, please check out our CrowdIn project.

Security Vulnerabilities

If you discover a security vulnerability within Cachet, please send an e-mail to us at We handle all security vulnerabilities on a case-by-case basis.


We offer a paid installation service, which starts at $99 but is subject to change, dependant on your setup and infrastructure.

To find out more, email us at

Author: Cachethq
Source Code: 
License: BSD-3-Clause license

#laravel #php #vue #composer 

Cachet: an Open Source Status Page System for Everyone
Rupert  Beatty

Rupert Beatty


Laravel-hashids: A Hashids Bridge for Laravel

Laravel Hashids

A Hashids bridge for Laravel.

// Encode integers.

// Decode strings.

// Dependency injection example.


Require this package, with Composer, in the root directory of your project.

composer require vinkla/hashids


Laravel Hashids requires connection configuration. To get started, you'll need to publish all vendor assets:

$ php artisan vendor:publish

This will create a config/hashids.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

Default Connection Name

This option default is where you may specify which of the connections below you wish to use as your default connection for all work. Of course, you may use many connections at once using the manager class. The default value for this setting is main.

Hashids Connections

This option connections is where each of the connections are setup for your application. Example configuration has been included, but you may add as many connections as you would like.


Here you can see an example of you may use this package. Out of the box, the default adapter is main. After you enter your authentication details in the config file, it will just work:

// You can alias this in config/app.php.
use Vinkla\Hashids\Facades\Hashids;

// We're done here - how easy was that, it just works!

// This example is simple and there are far more methods available.

The manager will behave like it is a Hashids\Hashids class. If you want to call specific connections, you can do that with the connection method:

use Vinkla\Hashids\Facades\Hashids;

// Writing this...

// identical to writing this

// and is also identical to writing this.

// This is because the main connection is configured to be the default.
Hashids::getDefaultConnection(); // This will return main.

// We can change the default connection.
Hashids::setDefaultConnection('alternative'); // The default is now alternative.

If you prefer to use dependency injection over facades, then you can inject the manager:

use Vinkla\Hashids\HashidsManager;

class Foo
    protected $hashids;

    public function __construct(HashidsManager $hashids)
        $this->hashids = $hashids;

    public function bar($id)


For more information on how to use the Hashids\Hashids class, check out the docs at hashids/hashids.

Author: Vinkla
Source Code: 
License: MIT license

#laravel #php #composer 

Laravel-hashids: A Hashids Bridge for Laravel
Rupert  Beatty

Rupert Beatty


Lavacharts: Lavacharts Is A Graphing / Charting Library for PHP 5.4+

Lavacharts 3.1.12    

Lavacharts is a graphing / chart library for PHP5.4+ that wraps the Google Chart API.

Developer Note

Please don't be discouraged if you see that it has been "years" since an update, but rather think that Lavacharts has settled into a "stable" state and requires less tinkering from me. I would love to add new features, but my responsibilities leave little room for my projects. I am happy to field issues, answer questions, debug and help if needed. Lavacharts is not vaporware! :smile:

Package Features

  • Updated! Laravel 5.5+ auto-discovery
  • Any option for customizing charts that Google supports, Lavacharts should as well. Just use the chart constructor to assign any customization options you wish!
  • Visit Google's Chart Gallery for details on available options
  • Custom JavaScript module for interacting with charts client-side
    • AJAX data reloading
    • Fetching charts
    • Events integration
  • Column Formatters & Roles
  • Blade template extensions for Laravel
  • Twig template extensions for Symfony
  • Carbon support for date/datetime/timeofday columns
  • Now supporting 22 Charts!
    • Annotation, Area, Bar, Bubble, Calendar, Candlestick, Column, Combo, Gantt, Gauge, Geo, Histogram, Line, Org, Pie, Sankey, Scatter, SteppedArea, Table, Timeline, TreeMap, and WordTree!

For complete documentation, please visit

Upgrade guide: Migrating from 2.5.x to 3.0.x

For contributing, a handy guide can be found here


In your project's main composer.json file, add this line to the requirements:

"khill/lavacharts": "^3.1"

Run Composer to install Lavacharts:

$ composer update

Framework Agnostic

If you are using Lavacharts with Silex, Lumen or your own Composer project, that's no problem! Just make sure to: require 'vendor/autoload.php'; within you project and create an instance of Lavacharts: $lava = new Khill\Lavacharts\Lavacharts;


To integrate Lavacharts into Laravel, a ServiceProvider has been included.

Laravel ~5.5

Thanks to the fantastic new Package Auto-Discovery feature added in 5.5, you're ready to go, no registration required :+1:


To modify the default configuration of Lavacharts, datetime formats for datatables or adding your maps api key... Publish the configuration with php artisan vendor:publish --tag=lavacharts

Laravel ~5.4

Register Lavacharts in your app by adding these lines to the respective arrays found in config/app.php:

// config/app.php

// ...
'providers' => [
    // ...


// ...
'aliases' => [
    // ...

    'Lava' => Khill\Lavacharts\Laravel\LavachartsFacade::class,


To modify the default configuration of Lavacharts, datetime formats for datatables or adding your maps api key... Publish the configuration with php artisan vendor:publish --tag=lavacharts

Laravel ~4

Register Lavacharts in your app by adding these lines to the respective arrays found in app/config/app.php:

// app/config/app.php

// ...
'providers' => array(
    // ...


// ...
'aliases' => array(
    // ...

    'Lava' => "Khill\Lavacharts\Laravel\LavachartsFacade",


To modify the default configuration of Lavacharts, datetime formats for datatables or adding your maps api key... Publish the configuration with php artisan config:publish khill/lavacharts


The package also includes a Bundle for Symfony to enable Lavacharts as a service that can be pulled from the Container.

Add Bundle

Add the bundle to the registerBundles method in the AppKernel, found at app/AppKernel.php:

// app/AppKernel.php

class AppKernel extends Kernel
    // ..

    public function registerBundles()
        $bundles = array(
            // ...

            new Khill\Lavacharts\Symfony\Bundle\LavachartsBundle(),

Import Config

Add the service definition to the app/config/config.yml file

  # ...
  - { resource: "@LavachartsBundle/Resources/config/services.yml"


The creation of charts is separated into two parts: First, within a route or controller, you define the chart, the data table, and the customization of the output.

Second, within a view, you use one line and the library will output all the necessary JavaScript code for you.

Basic Example

Here is an example of the simplest chart you can create: A line chart with one dataset and a title, no configuration.


Setting up your first chart.


$data = $lava->DataTable();

$data->addDateColumn('Day of Month')

// Random Data For Example
for ($a = 1; $a < 30; $a++) {
    $rowData = [
      "2017-4-$a", rand(800,1000), rand(800,1000)


Arrays work for datatables as well...

    ['date', 'Day of Month'],
    ['number', 'Projected'],
    ['number', 'Official']

Or you can use \Khill\Lavacharts\DataTables\DataFactory to create DataTables in another way

Chart Options

Customize your chart, with any options found in Google's documentation. Break objects down into arrays and pass to the chart.

$lava->LineChart('Stocks', $data, [
    'title' => 'Stock Market Trends',
    'animation' => [
        'startup' => true,
        'easing' => 'inAndOut'
    'colors' => ['blue', '#F4C1D8']

Output ID

The chart will needs to be output into a div on the page, so an html ID for a div is needed. Here is where you want your chart <div id="stocks-div"></div>

  • If no options for the chart are set, then the third parameter is the id of the output:
$lava->LineChart('Stocks', $data, 'stocks-div');
  • If there are options set for the chart, then the id may be included in the options:
$lava->LineChart('Stocks', $data, [
    'elementId' => 'stocks-div'
    'title' => 'Stock Market Trends'
  • The 4th parameter will also work:
$lava->LineChart('Stocks', $data, [
    'title' => 'Stock Market Trends'
], 'stocks-div');


Pass the main Lavacharts instance to the view, because all of the defined charts are stored within, and render!

<?= $lava->render('LineChart', 'Stocks', 'stocks-div'); ?>

Or if you have multiple charts, you can condense theh view code withL

<?= $lava->renderAll(); ?>


The complete changelog can be found here

Stargazers over time

Stargazers over time

Author: Kevinkhill
Source Code: 
License: View license

#laravel #charts #php #composer 

Lavacharts: Lavacharts Is A Graphing / Charting Library for PHP 5.4+
Beth  Nabimanya

Beth Nabimanya


PhpStorm 2021.1: Preview for PHP and HTML Files, 20+ New Inspections, Improvements in ...

PhpStorm 2021.1 is now available!

This major release introduces a built-in preview for PHP and HTML files, 20+ new inspections to help prevent bugs, improvements in all subsystems, pair programming via Code With Me, and much more.

#releases #2021-1 #code-with-me #composer #docker #php

PhpStorm 2021.1: Preview for PHP and HTML Files, 20+ New Inspections, Improvements in ...