Skip to content
This repository was archived by the owner on Oct 8, 2023. It is now read-only.

Commit d747323

Browse files
committed
Rename project and create readme
1 parent 56bf338 commit d747323

28 files changed

+189
-136
lines changed

.docker/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
1818
RUN rm /etc/nginx/conf.d/default.conf
1919

2020
# Setup document root
21-
RUN mkdir -p /var/www/html
22-
RUN chown -R nobody.nobody /var/www/html && \
21+
RUN mkdir -p /app
22+
RUN chown -R nobody.nobody /app && \
2323
chown -R nobody.nobody /run && \
2424
chown -R nobody.nobody /var/lib/nginx && \
2525
chown -R nobody.nobody /var/log/nginx
2626

2727
# Create a new volume
28-
VOLUME /var/www/html/storage
28+
VOLUME /app/storage
2929

3030
# Switch to a non-root user
3131
USER nobody
3232

3333
# Add application
34-
WORKDIR /var/www/html
34+
WORKDIR /app
3535
COPY --chown=nobody . ./
3636

3737
# Install Composer dependencies

.docker/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ http {
3636
listen 8080 default_server;
3737
server_name _;
3838

39-
root /var/www/html/public;
39+
root /app/public;
4040
index index.php;
4141

4242
location / {

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
pull_request:
1010

1111
env:
12-
IMAGE_NAME: medias-php-service
12+
IMAGE_NAME: files-php-service
1313

1414
jobs:
1515
test:

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<h1 align="center">FilesService</h1>
2+
3+
<h4 align="center">
4+
A simple service for your web-based files.
5+
<br>
6+
Works with PHP 5.6+
7+
</h4>
8+
9+
<p align="center">
10+
<a href="https://github.com/utarwyn/files-php-service/actions?query=workflow%3ABuild"><img src="https://github.com/utarwyn/files-php-service/workflows/Build/badge.svg" alt="Publishing status"></a>
11+
<a href="https://github.com/utarwyn/files-php-service/actions?query=workflow%3APublish"><img src="https://github.com/utarwyn/files-php-service/workflows/Publish/badge.svg" alt="Publishing status"></a>
12+
<a href="https://packagist.org/packages/utarwyn/files-php-service"><img src="https://poser.pugx.org/utawyn/files-php-service/v/stable.svg" alt="Latest Stable Version"></a>
13+
<a href="https://github.com/utarwyn/files-php-service/blob/master/LICENSE"><img src="https://poser.pugx.org/utarwyn/files-php-service/license.svg" alt="License"></a>
14+
</p>
15+
16+
FilesService is a **lightweight self-hosted service** which provides an easy way to manage web-based files.
17+
It supplies a documented **RESTful API** and an authentication system based on **OAuth2** to store files in a protected bucket.
18+
19+
Installation
20+
------------
21+
22+
1. Install the service with Composer:\
23+
`composer create-project utarwyn/files-php-service`
24+
2. Move file `.env.example` to `.env` and configure it.
25+
3. Use Nginx or Apache to provide an access to the `public` folder.
26+
27+
Use it with Docker
28+
------------
29+
30+
1. Pull the latest image from [DockerHub][1]:\
31+
`docker pull utarwyn/files-php-service`
32+
2. Create a folder to store uploaded files somewhere.
33+
3. Create a `.env` file based on the `.env.example` in the repository.
34+
4. Start the Docker container by providing their paths:\
35+
`docker run -v /home/.env:/app/.env -v /home/storage:/app/storage -p 80:8080 utarwyn/files-php-service`
36+
37+
Documentation
38+
------------
39+
40+
> Soon!
41+
42+
License
43+
--------
44+
45+
FilesService is open-sourced software licensed under the [MIT license][2].
46+
47+
---
48+
> GitHub [@utarwyn][3] &nbsp;&middot;&nbsp; Twitter [@Utarwyn][4]
49+
50+
[1]: https://hub.docker.com/r/utarwyn/files-php-service
51+
[2]: https://opensource.org/licenses/MIT
52+
[3]: https://github.com/utarwyn
53+
[4]: https://twitter.com/Utarwyn

app/Auth/AuthController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?php
22

3-
namespace MediasService\Auth;
3+
namespace FilesService\Auth;
44

5-
use MediasService\Auth\Token\AuthTokenStrategyFactory;
6-
use MediasService\Controller;
5+
use FilesService\Auth\Token\AuthTokenStrategyFactory;
6+
use FilesService\Controller;
77

88
/**
99
* Class AuthController.
1010
*
1111
* @author Maxime Malgorn <[email protected]>
1212
* @license MIT
13-
* @package MediasService\Auth
13+
* @package FilesService\Auth
1414
* @since 1.0.0
1515
*/
1616
class AuthController extends Controller

app/Auth/Token/AuthTokenInvalidException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace MediasService\Auth\Token;
3+
namespace FilesService\Auth\Token;
44

55
use UnexpectedValueException;
66

@@ -10,7 +10,7 @@
1010
*
1111
* @author Maxime Malgorn <[email protected]>
1212
* @license MIT
13-
* @package MediasService\Auth\Token
13+
* @package FilesService\Auth\Token
1414
* @since 1.0.0
1515
*/
1616
class AuthTokenInvalidException extends UnexpectedValueException

app/Auth/Token/AuthTokenStrategy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace MediasService\Auth\Token;
3+
namespace FilesService\Auth\Token;
44

55
/**
66
* Interface AuthTokenStrategy.
77
*
88
* @author Maxime Malgorn <[email protected]>
99
* @license MIT
10-
* @package MediasService\Auth\Token
10+
* @package FilesService\Auth\Token
1111
* @since 1.0.0
1212
*/
1313
interface AuthTokenStrategy

app/Auth/Token/AuthTokenStrategyFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace MediasService\Auth\Token;
3+
namespace FilesService\Auth\Token;
44

55
/**
66
* Class AuthTokenStrategyFactory.
77
*
88
* @author Maxime Malgorn <[email protected]>
99
* @license MIT
10-
* @package MediasService\Auth\Token
10+
* @package FilesService\Auth\Token
1111
* @since 1.0.0
1212
*/
1313
class AuthTokenStrategyFactory

app/Auth/Token/JWTAuthTokenStrategy.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace MediasService\Auth\Token;
3+
namespace FilesService\Auth\Token;
44

55
use Firebase\JWT\ExpiredException;
66
use Firebase\JWT\JWT;
@@ -11,7 +11,7 @@
1111
*
1212
* @author Maxime Malgorn <[email protected]>
1313
* @license MIT
14-
* @package MediasService\Auth\Token
14+
* @package FilesService\Auth\Token
1515
* @since 1.0.0
1616
*/
1717
class JWTAuthTokenStrategy implements AuthTokenStrategy
@@ -32,7 +32,7 @@ public function __construct()
3232
public function generate($duration = 3600)
3333
{
3434
return JWT::encode([
35-
'iss' => 'media_api',
35+
'iss' => 'file_api',
3636
'iat' => time(),
3737
'exp' => time() + $duration
3838
], $this->secret);

app/Controller.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?php
22

3-
namespace MediasService;
3+
namespace FilesService;
44

5-
use MediasService\Auth\Token\AuthTokenInvalidException;
6-
use MediasService\Auth\Token\AuthTokenStrategyFactory;
5+
use FilesService\Auth\Token\AuthTokenInvalidException;
6+
use FilesService\Auth\Token\AuthTokenStrategyFactory;
77

88
/**
99
* Main Controller, defines basic behaviors for others controllers.
1010
*
1111
* @author Maxime Malgorn <[email protected]>
1212
* @license MIT
13-
* @package MediasService
13+
* @package FilesService
1414
* @since 1.0.0
1515
*/
1616
class Controller

0 commit comments

Comments
 (0)