Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tchapi/tuneefy2
🎶 tuneefy is a unified way to share music with your friends, over various online music services
https://github.com/tchapi/tuneefy2
composer music php71 slim streaming
Last synced: 24 days ago
JSON representation
🎶 tuneefy is a unified way to share music with your friends, over various online music services
- Host: GitHub
- URL: https://github.com/tchapi/tuneefy2
- Owner: tchapi
- License: gpl-2.0
- Created: 2015-04-03T09:30:09.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-04-14T21:41:16.000Z (7 months ago)
- Last Synced: 2024-04-15T02:30:15.025Z (7 months ago)
- Topics: composer, music, php71, slim, streaming
- Language: PHP
- Homepage: https://tuneefy.com
- Size: 2.81 MB
- Stars: 22
- Watchers: 4
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tuneefy _2_
A new version of [tuneefy](http://tuneefy.com) built for **PHP 7 / 8** and **Node 14+**, from the ground up, using the minimal [Slim](https://www.slimframework.com/) framework and a few helper libraries.
### Installing
This project uses [composer 2](https://getcomposer.org/). Just run :
composer install
### Creating tables
Tuneefy needs a variety of tables to work properly; you can populate your database with the following :
mysql -u user -p database_name < ./structure.sql
### Building assets & API doc
To build the assets and the API documentation, I use **yarn** and some modules.
yarn install
yarn run build
yarn run api-documentation### Composer packages used
- [Composer](https://getcomposer.org/), providing a nice package manager *and* a practical PSR-4 autoloader
- [Symfony\Yaml](http://symfony.com/doc/current/components/yaml/introduction.html) to parse the configuration files
- [Slim 4](http://www.slimframework.com/), a lightweight RESTful framework
- [Twig](http://twig.sensiolabs.org/), a template engine
- [XmlToJsonConverter](https://github.com/markwilson/xml-to-json) to convert Amazon XML to correct JSON
- [RKA Content-Type renderer](https://github.com/akrabat/rka-content-type-renderer) to output JSON / XML / HTML for the API
- [Slim basic auth](https://github.com/tuupola/slim-basic-auth) for admin access#### Dev packages
- [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to lint the PHP code
- [PHPUnit](https://phpunit.de/) for unit tests### NPM (dev) packages used
- [Gulp](http://gulpjs.com/) , including `gulp-sass`, `gulp-uglify` and `pump` for building assets
- [Aglio](https://github.com/danielgtaylor/aglio) for generating the API docs### On the frontend side of things
I'm using [JQuery](http://jquery.com) to cover the DOM manipulation tasks and related stuff.
### Code structure
This project is a very basic composer project with a PSR-4 autoloader.
The source is in `src/tuneefy` and is organised as such :* **MusicalEntity** includes the model for a musical entity (_album or track_)
* **Controller** includes the controllers for the various routes (api and frontend)
* **Platform** includes all the platform-related code, especially the specific methods for each remote API call
* **Utils** includes various utilities such as custom Slim error handlers
* and two top-level classes : **Application** and **PlatformEngine** that deal with the application itself and how it interacts with the platforms### Tests
The tests are under the `./tests` folder and I use **Codeception** to run them. You have to first create the `codeception.yml` file (or copy it from the dist file present in the repo).
Afterwards, just run :
vendor/bin/codecept run --steps
Beforehand, do not forget to launch a development web server so that the functional tests have an endpoint to test. For instance :
php -S localhost:8000 -t web
php -S localhost:8001 -t web_apiThere should be 40 tests containing 697 assertions.
> Sometimes a platform fails to respond correctly due to network latencies or such. Re-run the tests in this case, it should pass fine the second time.
### API
The API endpoints require an OAuth access token. The token is necessary to authenticate **all** requests to the API.
The tuneefy API currently supports the [OAuth 2 draft](https://oauth.net/2/) specification. All OAuth2 requests MUST use the SSL endpoint available at https://data.tuneefy.com/.
OAuth 2.0 is a simple and secure authentication mechanism. It allows applications to acquire an access token for tuneefy via a POST request to a token endpoint. Authentication with OAuth can be accomplished in the following steps:
1. Register for an API key by sending a mail to [email protected]
2. Exchange your customer id and secret for an access token
3. Make requests by passing the token in the Authorization header
4. When your token expires, you can get a new one#### Apply for an API key
You can get an API key and associated secret by sending an email to [email protected].
#### Web Service Rate Limits
Limits are placed on the number of API requests you may make using your API key. Rate limits may vary by service, but the defaults are 100 requests per hour.
#### Full documentation
The full documentation is available at https://data.tuneefy.com. An API blueprint is also available [here](https://github.com/tchapi/tuneefy2/blob/master/app/templates/api/main.apib) — use your preferred renderer to build it. We use Aglio.
- - -
> If you want to participate/contribute, feel free to create pull requests or issues so we can make Tuneefy better and more efficient !