1676874859
⚡ 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.
yarn add langchain
import { OpenAI } from "langchain/llms";
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.
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.
For full documentation of prompts, chains, agents and more, please see here.
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.
Author: hwchase17
Source Code: https://github.com/hwchase17/langchainjs
License: MIT license
1672281742
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.
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.
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.
Author: irazasyed
Source Code: https://github.com/irazasyed/telegram-bot-sdk
License: BSD-3-Clause license
1667343240
Laravel Messenger
This package will allow you to add a full user messaging system into your Laravel application.
How are you using laravel-messenger?
Laravel | Messenger |
---|---|
4.* | 1.* |
5.0-5.4 | <= 2.16.2 |
5.5+ | 2.* |
Installation instructions for Laravel 4 can be found here.
composer require cmgmyr/messenger
Or place manually in composer.json:
"require": {
"cmgmyr/messenger": "~2.0"
}
Run:
composer update
Add the service provider to config/app.php
under providers
:
'providers' => [
Cmgmyr\Messenger\MessengerServiceProvider::class,
],
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:
config/messenger.php
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;
}
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
This package used AndreasHeiberg/laravel-messenger as a starting point.
Author: cmgmyr
Source Code: https://github.com/cmgmyr/laravel-messenger
License: MIT license
1667310780
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.
Both GitHub-hosted
and self-hosted
runners are supported by setup-php
on the following OS/Platforms.
Virtual environment | YAML workflow label | Pre-installed PHP |
---|---|---|
Ubuntu 22.04 | ubuntu-22.04 | PHP 8.1 |
Ubuntu 20.04 | ubuntu-latest or ubuntu-20.04 | PHP 7.4 to PHP 8.1 |
Ubuntu 18.04 | ubuntu-18.04 | PHP 7.2 to PHP 8.1 |
Windows Server 2022 | windows-latest or windows-2022 | PHP 8.1 |
Windows Server 2019 | windows-2019 | PHP 8.1 |
macOS Monterey 12.x | macos-12 | PHP 8.1 |
macOS Big Sur 11.x | macos-latest or macos-11 | PHP 8.1 |
macOS Catalina 10.15 | macos-10.15 | PHP 8.1 |
Host OS/Virtual environment | YAML workflow label |
---|---|
Ubuntu 22.04 | self-hosted or Linux |
Ubuntu 20.04 | self-hosted or Linux |
Ubuntu 18.04 | self-hosted or Linux |
Debian 11 | self-hosted or Linux |
Debian 10 | self-hosted or Linux |
Windows 7 and newer | self-hosted or Windows |
Windows Server 2012 R2 and newer | self-hosted or Windows |
macOS Monterey 12.x x86_64/arm64 | self-hosted or macOS |
macOS Big Sur 11.x x86_64/arm64 | self-hosted or macOS |
macOS Catalina 10.15 | self-hosted or macOS |
setup-php
switches to it, otherwise it installs the PHP version.On all supported OS/Platforms the following PHP versions are supported as per the runner.
PHP Version | Stability | Release Support | Runner Support |
---|---|---|---|
5.3 | Stable | End of life | GitHub-hosted |
5.4 | Stable | End of life | GitHub-hosted |
5.5 | Stable | End of life | GitHub-hosted |
5.6 | Stable | End of life | GitHub-hosted , self-hosted |
7.0 | Stable | End of life | GitHub-hosted , self-hosted |
7.1 | Stable | End of life | GitHub-hosted , self-hosted |
7.2 | Stable | End of life | GitHub-hosted , self-hosted |
7.3 | Stable | End of life | GitHub-hosted , self-hosted |
7.4 | Stable | Security fixes only | GitHub-hosted , self-hosted |
8.0 | Stable | Active | GitHub-hosted , self-hosted |
8.1 | Stable | Active | GitHub-hosted , self-hosted |
8.2 | Nightly | In development | GitHub-hosted , self-hosted |
Notes:
8.2
in php-version
input installs a nightly build of PHP 8.2.0-dev
. See nightly build setup for more information.PHP 8.0
and above, refer to the JIT configuration section.PHP extensions can be set up using the extensions
input. It accepts a string
in csv-format.
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
with:
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
with:
php-version: '5.4'
extensions: swoole-1.9.3
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
with:
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
with:
php-version: '8.1'
extensions: :opcache
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
with:
php-version: '8.1'
extensions: none, mbstring
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
with:
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
with:
php-version: '8.1'
extensions: oci8
env:
fail-fast: true
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
with:
php-version: '8.1'
tools: php-cs-fixer, phpunit
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
with:
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:
tool:1.2.3
or tool:1.2.3-beta1
.tool:1
or tool:1.x
.tool:1.2
or tool:1.2.x
.- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: php-cs-fixer:3.5, phpunit:9.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
with:
php-version: '8.1'
tools: composer:v2
tools: none
to skip it.- name: Setup PHP without composer
uses: shivammathur/setup-php@v2
with:
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
with:
php-version: '8.1'
tools: deployer
env:
fail-fast: true
Notes
tools
is useful to set up tools which are only used in CI workflows, thus keeping your composer.json
tidy.--no-dev
and install required tools using tools
input to speed up your workflow.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
.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.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
with:
php-version: '8.1'
coverage: xdebug
coverage: xdebug
, the latest version of Xdebug compatible with the PHP version is set up by default.coverage: xdebug2
.- name: Setup PHP with Xdebug 2.x
uses: shivammathur/setup-php@v2
with:
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.
src
, lib
or, app
, specify pcov.directory
using the ini-values
input.- name: Setup PHP with PCOV
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
ini-values: pcov.directory=api #optional, see above for usage.
coverage: pcov
pcov/clobber
before executing your tests.- name: Setup PCOV
run: |
composer require pcov/clobber
vendor/bin/pcov clobber
Specify coverage: none
to disable both Xdebug
and PCOV
.
Disable coverage for these reasons:
phpdbg
for running your tests.blackfire
.- name: Setup PHP with no coverage driver
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
Specify using
with
keyword
php-version
(required)string
. For example '8.0'
.latest
to set up the latest stable PHP version.nightly
to set up a nightly build from the master branch of PHP.d.x
, where d
is the major version. For example 5.x
, 7.x
and 8.x
.extensions
(optional)string
in csv-format. For example mbstring, :opcache
.none
to disable all shared extensions.:
are disabled.ini-file
(optional)php.ini
file.production
, development
or none
.php.ini
file is used.ini-values
(optional)php.ini
.string
in csv-format. For example post_max_size=256M, max_execution_time=180
.xdebug.mode="develop,coverage"
.coverage
(optional)xdebug
, pcov
or none
.tools
(optional)string
in csv-format. For example: phpunit, phpcs
php-version
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.
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- name: Print PHP version
run: echo ${{ steps.setup-php.outputs.php-version }}
Specify using
env
keyword
fail-fast
(optional)false
.true
and false
.phpts
(optional)ts
and nts
.nts
.update
(optional)true
and false
.false
.See below for more info.
Set up a particular PHP version.
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
tools: php-cs-fixer, phpunit
Set up multiple PHP versions on multiple operating systems.
jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
php-versions: ['7.4', '8.0', '8.1']
phpunit-versions: ['latest']
include:
- operating-system: 'ubuntu-latest'
php-versions: '7.2'
phpunit-versions: '8.5.21'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
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 }}
Set up a nightly build of
PHP 8.2
.
steps:
- name: Setup nightly PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
tools: php-cs-fixer, phpunit
Set up a PHP build with debugging symbols.
debug
environment variable to set up a build with debugging symbols for PHP 5.6 and above.steps:
- name: Setup PHP with debugging symbols
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
env:
debug: true # specify true or false
Set up
TS
orNTS
PHP onWindows
.
NTS
versions are set up by default.Ubuntu
and macOS
only NTS
versions are supported.Windows
both TS
and NTS
versions are supported.jobs:
run:
runs-on: windows-latest
name: Setup PHP TS on Windows
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
env:
phpts: ts # specify ts or nts
Update to the latest patch of PHP versions.
ppa:ondrej/php
is missing on the Ubuntu GitHub environment, the PHP version is updated to the latest patch release.update
environment variable to true
for updating to the latest release.- name: Setup PHP with latest versions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
env:
update: true # specify true or false
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
with:
php-version: '8.1'
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
.shivammathur/node
images as containers. These have compatible Nodejs
installed for setup-php
.ARM
based setup, you will need self-hosted runners.jobs:
run:
runs-on: ubuntu-latest
container: shivammathur/node:latest-${{ matrix.arch }}
strategy:
matrix:
arch: ["amd64", "i386"]
steps:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
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.
jobs:
run:
runs-on: self-hosted
strategy:
matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }}
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
env:
runner: self-hosted
Notes
self-hosted
runners which are used by GitHub-hosted
runners.Test your
Ubuntu
workflow locally usingnektos/act
.
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
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
Enable Just-in-time (JIT) on PHP 8.0 and above.
opcache
in cli mode by setting opcache.enable_cli=1
.Xdebug
, PCOV
, and other extensions which override zend_execute_ex
function, so set coverage: none
and disable any such extension if added.opcache.jit=1235
and opcache.jit_buffer_size=256M
are set which can be changed using ini-values
input.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
with:
php-version: '8.1'
coverage: none
ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
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.
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
with:
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
Notes
vendor
directory using action/cache
as that will have side effects.composer.lock
, you can use the hash of composer.json
as the key for your cache.key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
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 }}-
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
with:
php-version: '8.1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
with:
php-version: '8.1'
env:
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
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
with:
php-version: '8.1'
env:
COMPOSER_AUTH_JSON: |
{
"http-basic": {
"example.org": {
"username": "${{ secrets.EXAMPLE_ORG_USERNAME }}",
"password": "${{ secrets.EXAMPLE_ORG_PASSWORD }}"
}
}
}
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
with:
php-version: '8.1'
- name: Run PHP code
shell: php {0}
run: |
<?php
$welcome = "Hello, world";
echo $welcome;
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
with:
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
with:
php-version: '8.1'
tools: psalm
- name: Run Psalm
run: psalm --output-format=github
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
with:
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/Package | Runs on | Workflow |
---|---|---|
Blackfire | macOS , ubuntu and windows | blackfire.yml |
Blackfire Player | macOS , ubuntu and windows | blackfire-player.yml |
CakePHP with MySQL and Redis | ubuntu | cakephp-mysql.yml |
CakePHP with PostgreSQL and Redis | ubuntu | cakephp-postgres.yml |
CakePHP without services | macOS , ubuntu and windows | cakephp.yml |
CodeIgniter | macOS , ubuntu and windows | codeigniter.yml |
Laminas MVC | macOS , ubuntu and windows | laminas-mvc.yml |
Laravel with MySQL and Redis | ubuntu | laravel-mysql.yml |
Laravel with PostgreSQL and Redis | ubuntu | laravel-postgres.yml |
Laravel without services | macOS , ubuntu and windows | laravel.yml |
Lumen with MySQL and Redis | ubuntu | lumen-mysql.yml |
Lumen with PostgreSQL and Redis | ubuntu | lumen-postgres.yml |
Lumen without services | macOS , ubuntu and windows | lumen.yml |
Phalcon with MySQL | ubuntu | phalcon-mysql.yml |
Phalcon with PostgreSQL | ubuntu | phalcon-postgres.yml |
Roots/bedrock | ubuntu | bedrock.yml |
Roots/sage | ubuntu | sage.yml |
Slim Framework | macOS , ubuntu and windows | slim-framework.yml |
Symfony with MySQL | ubuntu | symfony-mysql.yml |
Symfony with PostgreSQL | ubuntu | symfony-postgres.yml |
Symfony without services | macOS , ubuntu and windows | symfony.yml |
Yii2 Starter Kit with MySQL | ubuntu | yii2-mysql.yml |
Yii2 Starter Kit with PostgreSQL | ubuntu | yii2-postgres.yml |
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.verbose
tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.master
branch as version, it might break your workflow after major releases as they have breaking changes.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.Author: Shivammathur
Source Code: https://github.com/shivammathur/setup-php
License: MIT license
1667271840
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. Runningcomposer update --dry-run roave/security-advisories
is an effective way to manually trigger a security version check.
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 team@roave.com 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.
Author: Roave
Source Code: https://github.com/Roave/SecurityAdvisories
License: MIT license
1666213200
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:
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
grumphp:
hooks_dir: ~
hooks_preset: local
git_hook_variables:
VAGRANT_HOST_DIR: .
VAGRANT_PROJECT_DIR: /var/www
EXEC_GRUMPHP_COMMAND: exec
ENV: {}
stop_on_failure: false
ignore_unstaged_changes: false
hide_circumvention_tip: false
process_timeout: 60
ascii:
failed: grumphp-grumpy.txt
succeeded: grumphp-happy.txt
parallel:
enabled: true
max_workers: 32
fixer:
enabled: true
fix_by_default: false
environment:
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:
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!
Bugs and feature request are tracked on GitHub. Please take a look at our rules before contributing your code.
Author: phpro
Source Code: https://github.com/phpro/grumphp
License: MIT license
1665788760
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.
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' => 'foo@bar.com'
]);
$data = $database->select('account', [
'user_name',
'email'
], [
'user_id' => 50
]);
echo json_encode($data);
// [{
// "user_name" : "foo",
// "email" : "foo@bar.com",
// }]
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: https://medoo.in
Documentation: https://medoo.in/doc
Twitter: https://twitter.com/MedooPHP
Open Collective: https://opencollective.com/medoo
Author: Catfan
Source Code: https://github.com/catfan/Medoo
License: MIT license
1665721200
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.
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.
DB_NAME
- Database nameDB_USER
- Database userDB_PASSWORD
- Database passwordDB_HOST
- Database hostDATABASE_URL
for using a DSN instead of using the variables above (e.g. mysql://user:password@127.0.0.1:3306/db_name
)WP_ENV
- Set to environment (development
, staging
, production
)WP_HOME
- Full URL to WordPress home (https://example.com)WP_SITEURL
- Full URL to WordPress including subdirectory (https://example.com/wp)AUTH_KEY
, SECURE_AUTH_KEY
, LOGGED_IN_KEY
, NONCE_KEY
, AUTH_SALT
, SECURE_AUTH_SALT
, LOGGED_IN_SALT
, NONCE_SALT
web/app/themes/
as you would for a normal WordPress siteweb
folder: /path/to/site/web/
https://example.com/wp/wp-admin/
Keep track of development and community news.
Author: Roots
Source Code: https://github.com/roots/bedrock
License: MIT license
1665625680
Composer helps you declare, manage, and install dependencies of PHP projects.
See https://getcomposer.org/ for more information and documentation.
Download and install Composer by following the official instructions.
For usage, see the documentation.
Find public packages on Packagist.org.
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.
PHP 7.2.5 or above for the latest version.
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.
Please send any sensitive issue to security@packagist.org. Thanks!
Author: Composer
Source Code: https://github.com/composer/composer
License: MIT license
1660199820
The repository for Coaster CMS (coastercms.org) 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.
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:
https://getcomposer.org/
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:
/public/uploads
/.env
/storage
Then follow the simple instructions in the install script.
For more details go to https://www.coastercms.org/documentation/developer-documentation
If you'd rather add Coaster CMS to an existing Laravel (v8) project, follow the steps through below:
composer require coastercms/framework:~8.0
to install packagephp artisan coaster:update-assets
to download admin assetsAuthor: CoasterCms
Source Code: https://github.com/CoasterCms/coastercms
License: GPL-3.0 license
1660173240
SleepingOwl Admin is an administrative interface builder for Laravel.
ver 8.*
(last Released)Install SleepingOwl Admin
composer require laravelrus/sleepingowl:8.*
ver 7.*
Install SleepingOwl Admin
composer require laravelrus/sleepingowl:7.*
or
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
(https://laravel.com/docs/authentication) 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'],
or
'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(((
Powered by Laravel 5.5 - 9+. (latest tested version 9.14.1)
Russian (90% process)
English (30% process)
Author: LaravelRUS
Source Code: https://github.com/LaravelRUS/SleepingOwlAdmin
License: MIT license
1659474600
Cachet is a beautiful and powerful open source status page system, a free replacement to services such as StatusPage.io, Status.io and others.
Cachet is a BSD-3-licensed open source project. If you'd like to support future development, check out the Patreon campaign.
Use of master
in a production environment is not recommended as it may change at any time.
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!
We're always looking for new translations.
Of course bug reports, feature requests and documentation are always appreciated.
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:
./resources/assets/sass/
gulp
If you're making a lot of changes, you'll find that running gulp watch
will make life easier for you!
Built using Laravel.
We use these extra dependencies to develop Cachet:
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.
You can now find our documentation at https://docs.cachethq.io.
To test out the demo, you may login to the Dashboard with the following:
The demo is reset every half hour.
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.
If you discover a security vulnerability within Cachet, please send an e-mail to us at support@alt-three.com. 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 support@alt-three.com
Author: Cachethq
Source Code: https://github.com/cachethq/Cachet
License: BSD-3-Clause license
1658313300
A Hashids bridge for Laravel.
// Encode integers.
Hashids::encode(4815162342);
// Decode strings.
Hashids::decode('1LLb3b4ck');
// Dependency injection example.
$hashidsManager->encode(911);
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.
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
.
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!
Hashids::encode(4815162342);
// This example is simple and there are far more methods available.
Hashids::decode('doyouthinkthatsairyourebreathingnow');
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...
Hashids::connection('main')->encode($id);
// ...is identical to writing this
Hashids::encode($id);
// and is also identical to writing this.
Hashids::connection()->encode($id);
// 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)
{
$this->hashids->encode($id);
}
}
App::make('Foo')->bar();
For more information on how to use the Hashids\Hashids
class, check out the docs at hashids/hashids
.
Author: Vinkla
Source Code: https://github.com/vinkla/laravel-hashids
License: MIT license
1658233800
Lavacharts is a graphing / chart library for PHP5.4+ that wraps the Google Chart API.
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:
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
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.
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
Register Lavacharts in your app by adding these lines to the respective arrays found in config/app.php
:
<?php
// config/app.php
// ...
'providers' => [
// ...
Khill\Lavacharts\Laravel\LavachartsServiceProvider::class,
],
// ...
'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
Register Lavacharts in your app by adding these lines to the respective arrays found in app/config/app.php
:
<?php
// app/config/app.php
// ...
'providers' => array(
// ...
"Khill\Lavacharts\Laravel\LavachartsServiceProvider",
),
// ...
'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 the bundle to the registerBundles method in the AppKernel, found at app/AppKernel.php
:
<?php
// app/AppKernel.php
class AppKernel extends Kernel
{
// ..
public function registerBundles()
{
$bundles = array(
// ...
new Khill\Lavacharts\Symfony\Bundle\LavachartsBundle(),
);
}
}
Add the service definition to the app/config/config.yml
file
imports:
# ...
- { resource: "@LavachartsBundle/Resources/config/services.yml"
Usage
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.
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')
->addNumberColumn('Projected')
->addNumberColumn('Official');
// Random Data For Example
for ($a = 1; $a < 30; $a++) {
$rowData = [
"2017-4-$a", rand(800,1000), rand(800,1000)
];
$data->addRow($rowData);
}
Arrays work for datatables as well...
$data->addColumns([
['date', 'Day of Month'],
['number', 'Projected'],
['number', 'Official']
]);
Or you can use \Khill\Lavacharts\DataTables\DataFactory
to create DataTables in another way
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']
]);
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>
$lava->LineChart('Stocks', $data, 'stocks-div');
$lava->LineChart('Stocks', $data, [
'elementId' => 'stocks-div'
'title' => 'Stock Market Trends'
]);
$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(); ?>
Changelog
The complete changelog can be found here
Author: Kevinkhill
Source Code: https://github.com/kevinkhill/lavacharts
License: View license
1624298040
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