Skip to content

Commit 5876bbd

Browse files
committed
Add bass headers
0 parents  commit 5876bbd

22 files changed

+1087
-0
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.yml]
15+
indent_size = 2

.gitattributes

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
* text=auto
2+
3+
/.github export-ignore
4+
/tests export-ignore
5+
6+
.editorconfig export-ignore
7+
.gitattributes export-ignore
8+
.gitignore export-ignore
9+
.styleci.yml export-ignore
10+
.travis.yml export-ignore
11+
12+
monorepo-builder.php export-ignore
13+
phpunit.xml export-ignore

.github/workflows/main.yml

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: build
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
env:
10+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
11+
12+
jobs:
13+
security:
14+
name: Security
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
php: [ '8.1' ] # Note: This workflow requires only the LATEST version of PHP
21+
os: [ ubuntu-latest ]
22+
23+
steps: # General Steps
24+
- name: Set Git To Use LF
25+
run: |
26+
git config --global core.autocrlf false
27+
git config --global core.eol lf
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
31+
# Install PHP Dependencies
32+
- name: Setup PHP ${{ matrix.php }}
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php }}
36+
- name: Validate Composer
37+
run: composer validate
38+
- name: Get Composer Cache Directory
39+
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
40+
id: composer-cache
41+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
42+
- name: Restore Composer Cache
43+
uses: actions/cache@v1
44+
with:
45+
path: ${{ steps.composer-cache.outputs.dir }}
46+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
47+
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
48+
- name: Install Dependencies
49+
uses: nick-invision/retry@v1
50+
with:
51+
timeout_minutes: 5
52+
max_attempts: 5
53+
command: composer update --prefer-dist --no-interaction --no-progress
54+
55+
# Execution
56+
- name: Security Advisories
57+
run: composer require --dev roave/security-advisories:dev-latest
58+
59+
psalm:
60+
name: Psalm
61+
runs-on: ${{ matrix.os }}
62+
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
php: [ '8.1' ] # Note: This workflow requires only the LATEST version of PHP
67+
os: [ ubuntu-latest ]
68+
69+
steps: # General Steps
70+
- name: Set Git To Use LF
71+
run: |
72+
git config --global core.autocrlf false
73+
git config --global core.eol lf
74+
- name: Checkout
75+
uses: actions/checkout@v2
76+
77+
# Install PHP Dependencies
78+
- name: Setup PHP ${{ matrix.php }}
79+
uses: shivammathur/setup-php@v2
80+
with:
81+
php-version: ${{ matrix.php }}
82+
- name: Validate Composer
83+
run: composer validate
84+
- name: Get Composer Cache Directory
85+
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
86+
id: composer-cache
87+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
88+
- name: Restore Composer Cache
89+
uses: actions/cache@v1
90+
with:
91+
path: ${{ steps.composer-cache.outputs.dir }}
92+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
93+
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
94+
- name: Install Dependencies
95+
uses: nick-invision/retry@v1
96+
with:
97+
timeout_minutes: 5
98+
max_attempts: 5
99+
command: composer update --prefer-dist --no-interaction --no-progress
100+
101+
# Execution
102+
- name: Static Analysis
103+
continue-on-error: true
104+
run: vendor/bin/psalm --no-cache
105+
106+
unit-tests:
107+
name: Build (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }})
108+
runs-on: ${{ matrix.os }}
109+
110+
strategy:
111+
fail-fast: false
112+
matrix:
113+
php: [ '8.1' ]
114+
os: [ ubuntu-latest, macos-latest, windows-latest ]
115+
stability: [ prefer-lowest, prefer-stable ]
116+
117+
steps: # General Steps
118+
- name: Set Git To Use LF
119+
run: |
120+
git config --global core.autocrlf false
121+
git config --global core.eol lf
122+
- name: Checkout
123+
uses: actions/checkout@v2
124+
125+
# Install PHP Dependencies
126+
- name: Setup PHP ${{ matrix.php }}
127+
uses: shivammathur/setup-php@v2
128+
with:
129+
php-version: ${{ matrix.php }}
130+
# PHP Extras
131+
coverage: pcov
132+
tools: pecl
133+
ini-values: "memory_limit=-1"
134+
extensions: phar, ffi
135+
- name: Validate Composer
136+
run: composer validate
137+
- name: Get Composer Cache Directory
138+
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
139+
id: composer-cache
140+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
141+
- name: Restore Composer Cache
142+
uses: actions/cache@v1
143+
with:
144+
path: ${{ steps.composer-cache.outputs.dir }}
145+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
146+
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
147+
- name: Install Dependencies
148+
uses: nick-invision/retry@v1
149+
with:
150+
timeout_minutes: 5
151+
max_attempts: 5
152+
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
153+
154+
# Execution
155+
- name: Execute Tests
156+
run: vendor/bin/phpunit --testdox --verbose

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.idea/
2+
vendor/
3+
4+
# Local testing
5+
include/
6+
test.php
7+
8+
composer.lock
9+
.phpunit.result.cache

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright © Kirill Nesmeyanov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<p align="center">
2+
<a href="https://github.com/php-ffi-libs">
3+
<img src="https://avatars.githubusercontent.com/u/101121010?s=256" width="128" />
4+
</a>
5+
</p>
6+
7+
<p align="center">
8+
<a href="https://github.com/php-ffi-libs/bass-headers/actions"><img src="https://github.com/php-ffi-libs/bass-headers/workflows/build/badge.svg"></a>
9+
<a href="https://packagist.org/packages/ffi-libs/bass-headers"><img src="https://img.shields.io/badge/PHP-8.1.0-ff0140.svg"></a>
10+
<a href="https://packagist.org/packages/ffi-libs/bass-headers"><img src="https://img.shields.io/badge/BASS-2.4-cc3c20.svg"></a>
11+
<a href="https://packagist.org/packages/ffi-libs/bass-headers"><img src="https://poser.pugx.org/ffi-libs/bass-headers/version" alt="Latest Stable Version"></a>
12+
<a href="https://packagist.org/packages/ffi-libs/bass-headers"><img src="https://poser.pugx.org/ffi-libs/bass-headers/v/unstable" alt="Latest Unstable Version"></a>
13+
<a href="https://packagist.org/packages/ffi-libs/bass-headers"><img src="https://poser.pugx.org/ffi-libs/bass-headers/downloads" alt="Total Downloads"></a>
14+
<a href="https://raw.githubusercontent.com/php-ffi-libs/bass-headers/master/LICENSE.md"><img src="https://poser.pugx.org/ffi-libs/bass-headers/license" alt="License MIT"></a>
15+
</p>
16+
17+
# Bass Headers
18+
19+
This is a C headers of the [Bass Audio](http://www.un4seen.com/) adopted for PHP.
20+
21+
## Requirements
22+
23+
- PHP >= 8.1
24+
25+
## Installation
26+
27+
Library is available as composer repository and can be installed using the
28+
following command in a root of your project.
29+
30+
```sh
31+
$ composer require ffi-libs/bass-headers
32+
```
33+
34+
## Usage
35+
36+
```php
37+
use FFI\Headers\Bass;
38+
39+
$headers = Bass::create(
40+
Bass\Version::V2_4, // Bass Headers Version
41+
);
42+
43+
echo $headers;
44+
```
45+
46+
> Please note that the use of header files is not the latest version:
47+
> - Takes time to download and install (This will be done in the background
48+
> during initialization).
49+
> - May not be compatible with the PHP headers library.
50+

composer.json

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "ffi-libs/bass-headers",
3+
"type": "library",
4+
"description": "PHP FFI BassAL Headers",
5+
"license": "MIT",
6+
"keywords": ["ffi", "headers", "bass", "c", "music", "audio", "sound"],
7+
"support": {
8+
"source": "https://github.com/php-ffi-libs/bass-headers",
9+
"issues": "https://github.com/php-ffi-libs/bass-headers/issues",
10+
"docs": "https://github.com/php-ffi-libs/bass-headers/blob/master/README.md"
11+
},
12+
"authors": [
13+
{
14+
"name": "Nesmeyanov Kirill",
15+
"email": "[email protected]",
16+
"homepage": "https://serafimarts.ru",
17+
"role": "maintainer"
18+
}
19+
],
20+
"require": {
21+
"php": "^8.1",
22+
"ext-phar": "*",
23+
"ffi/preprocessor": "^0.2.1|^1.0",
24+
"ffi-libs/headers-contracts": "^1.0"
25+
},
26+
"autoload": {
27+
"psr-4": {
28+
"FFI\\Headers\\": "src"
29+
}
30+
},
31+
"require-dev": {
32+
"ffi/env": "^0.1|^1.0",
33+
"ffi/location": "^0.1|^1.0",
34+
"vimeo/psalm": "^4.22.0",
35+
"phpunit/phpunit": "^9.5.15"
36+
},
37+
"autoload-dev": {
38+
"psr-4": {
39+
"FFI\\Headers\\Bass\\Tests\\": "tests"
40+
}
41+
},
42+
"config": {
43+
"sort-packages": true,
44+
"allow-plugins": {
45+
"composer/package-versions-deprecated": true,
46+
"phing/phing-composer-configurator": false
47+
}
48+
},
49+
"provide": {
50+
"ffi-libs/headers-contracts-implementation": "^1.0"
51+
},
52+
"extra": {
53+
"branch-alias": {
54+
"dev-master": "1.0.x-dev"
55+
}
56+
},
57+
"minimum-stability": "dev",
58+
"prefer-stable": true
59+
}

phpunit.xml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
colors="true"
5+
backupGlobals="true"
6+
stopOnFailure="false"
7+
processIsolation="false"
8+
backupStaticAttributes="false"
9+
bootstrap="vendor/autoload.php"
10+
convertErrorsToExceptions="true"
11+
convertNoticesToExceptions="true"
12+
convertWarningsToExceptions="true"
13+
>
14+
<coverage>
15+
<include>
16+
<directory suffix=".php">src</directory>
17+
</include>
18+
</coverage>
19+
<testsuites>
20+
<testsuite name="Test Suite">
21+
<directory suffix="TestCase.php">tests</directory>
22+
</testsuite>
23+
</testsuites>
24+
<php>
25+
<ini name="error_reporting" value="-1"/>
26+
<ini name="memory_limit" value="-1"/>
27+
</php>
28+
</phpunit>

psalm.xml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="1"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
xmlns:xi="http://www.w3.org/2001/XInclude"
9+
>
10+
<projectFiles>
11+
<directory name="src" />
12+
<ignoreFiles>
13+
<directory name="vendor" />
14+
</ignoreFiles>
15+
</projectFiles>
16+
</psalm>

resources/headers/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!.gitignore
3+
!2.4/

0 commit comments

Comments
 (0)