Skip to content

Commit

Permalink
Merge pull request #61 from conjoon/dev
Browse files Browse the repository at this point in the history
refactor: update project name to "lumen-app-email" and sources accord…
  • Loading branch information
ThorstenSuckow authored May 12, 2022
2 parents 59bb128 + 48f4c70 commit 10959be
Show file tree
Hide file tree
Showing 53 changed files with 177 additions and 368 deletions.
183 changes: 0 additions & 183 deletions .ddev/config.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Homestead.json
Homestead.yaml
.env
.phpunit.result.cache
.ddev
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019-2021 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
Copyright (c) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/lumen-app-email

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
106 changes: 22 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,102 +1,40 @@
# conjoon/php-ms-imapuser ![MIT](https://img.shields.io/github/license/conjoon/php-ms-imapuser) ![Tests](https://github.com/conjoon/php-ms-imapuser/actions/workflows/run.tests.yml/badge.svg)


Implements **[rest-api-email](https://github.com/conjoon/rest-api-description)**.
# conjoon/lumen-app-email ![MIT](https://img.shields.io/github/license/conjoon/lumen-app-email) ![Tests](https://github.com/conjoon/lumen-app-email/actions/workflows/run.tests.yml/badge.svg)
Microservice for IMAP operations.

## About
**conjoon/lumen-app-email** is a PHP application built with [Lumen](https://lumen.laravel.com).
It provides the REST API implementation according to [conjoon\/rest-api-description\#rest-api-email](conjoon/rest-api-description)
and serves as a functional webmail-backend for IMAP operations.

PHP microservice for accessing IMAP servers.
## Available REST API endpoints
* **rest-api-email**
<br>For the list of endpoints this microservice provides, please refer to the OpenApi-documentation of `rest-api-email`,
hosted at [conjoon/rest-api-description](https://github.com/conjoon/rest-api-description).

## Installation

#### Development environment
Starting up a default **ddev** instance with
```shell
$ ddev start
```
will expose the API to https://php-ms-imapuser.ddev.site. Please refer to the `ddev`-configuration if you need to adjust
settings according to your environment.

#### Installing the Backend
Navigate to the container's install directory. Then connect to the container via
```shell
$ ddev ssh
```
then run
```shell
$ git clone https://github.com/conjoon/lumen-app-email
$ cd ./lumen-app-email
$ composer i
```
This will install all required package dependencies.


## Available Rest API
* **rest-api-email**
<br>For the list of endpoints this microservice provides, please refer to the OpenApi-documentation of `rest-api-email`,
hosted at [conjoon/rest-api-description](https://github.com/conjoon/rest-api-description).
* **rest-imapuser**
<br>Authenticating a user against a single IMAP account.

## Required configurations

#### .env
The root directory of the project contains a [dotenv-configuration](https://github.com/vlucas/phpdotenv) file (`.env.example`).
Settings may be adjusted on your own to match your desired configuration for the environment the
microservice runs in. Copy and rename this file to `.env` and configure away!

#### 1. Allowed IMAP servers
In order for users to authenticate against IMAP servers, `php-ms-imapuser` provides
a template-configuration file in ```config/imapserver.php.example```.
In this file, you can specify an array of supported IMAP servers to which users
of your application can connect to.
This is how an example entry for the array looks like:;
```
"id" => "Google_Mail",
"inbox_type" => "IMAP",
"inbox_address" => 'imap.gmail.com',
"inbox_port" => 993,
"inbox_ssl" => true,
"outbox_address" => "smtp.gmail.com",
"outbox_port" => 465,
"outbox_ssl" => true,
"root" => ["INBOX"],
"match" => ["/\@(googlemail.)(com)$/mi"]
```
Along with the usual information regarding the connection options, the "match" entry should be a regular
expression that matches an email-address to "this" specific server configuration. The example
above will use the connection information for every user that uses an email-address matching
the regular expression ```"/\@(googlemail.)(com)$/mi"```.
Copy and rename this file to ```config/imapserver.php``` once all IMAP-servers were configured.

#### 2. Configuring CORS
The official [Lumen\-documentation](https://lumen.laravel.com/docs/) has guides
on setting up a webservers running a Lumen application.

**php-ms-imapuser** uses [fruitcake/laravel-cors](https://github.com/fruitcake/laravel-cors) for enabling
[Cross-Origin Resource Sharing](http://enable-cors.org/).
<br>
A configuration template can be found in ```config/cors.php.example```. You need to create a file named
```config/cors.php``` - basically the configuration of ```config/cors.php.example``` should work, but if
you need to set specific options, this would be the place to do so.
#### Configuration
Please refer to the official [documentation](./docs) of **lumen-app-email** for further information on
installation and configuration.

#### Options

| Option | Description | Default value |
|--------------------------|--------------------------------------------------------------------------|---------------|
| paths | You can enable CORS for 1 or multiple paths, eg. `['api/*'] ` | `[]` |
| allowed_origins | Matches the request origin. Wildcards can be used, eg. `*.mydomain.com` or `mydomain.com:*` | `['*']` |
| allowed_origins_patterns | Matches the request origin with `preg_match`. | `[]` |
| allowed_methods | Matches the request method. | `['*']` |
| allowed_headers | Sets the Access-Control-Allow-Headers response header. | `['*']` |
| exposed_headers | Sets the Access-Control-Expose-Headers response header. | `false` |
| max_age | Sets the Access-Control-Max-Age response header. | `0` |
| supports_credentials | Sets the Access-Control-Allow-Credentials header. | `false` |
## Additional Resources
### Official Docker Container
[conjoon\/ddev-ms-email](conjoon/ddev-ms-email) provides a `.ddev`/**Docker** configuration for a container
running **lumen-app-email** out-of-the-box.

## Troubleshooting
In case you cannot run tests from within this folder with your phpunit-installation, try running the tests with
phpunit included in the vendor directory:
```./vendor/bin/phpunit```

### Composer 2.0 - Pear/Horde vows
As of **v1.0.1**, _php-lib-conjoon_ no longer requires _Composer 1.*_ for installation.
For _Composer 2.*_-compatibility, _php-lib-conjoon_ relies on the following private composer
As of **v1.0.1**, **[php-lib-conjoon](conjoon/php-lib-conjoon)** no longer requires _Composer 1.*_ for installation.
For _Composer 2.*_-compatibility, **php-lib-conjoon** relies on the following private composer
package repository:

```
Expand Down
4 changes: 2 additions & 2 deletions app/bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* conjoon
* php-ms-imapuser
* Copyright (C) 2019-2021 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
* lumen-app-email
* Copyright (c) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/lumen-app-email
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
4 changes: 2 additions & 2 deletions app/bootstrap/bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* conjoon
* php-ms-imapuser
* Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
* lumen-app-email
* Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/lumen-app-email
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
8 changes: 4 additions & 4 deletions app/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* conjoon
* php-ms-imapuser
* Copyright (C) 2019-2021 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
* lumen-app-email
* Copyright (c) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/lumen-app-email
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -62,7 +62,7 @@
|
*/

"name" => env("APP_NAME", "php-ms-imapuser"),
"name" => env("APP_NAME", "lumen-app-email"),

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -101,7 +101,7 @@
|
*/

"url" => env("APP_URL", "https://php-ms-imapuser.ddev.site"),
"url" => env("APP_URL", "https://lumen-app-email.ddev.site"),

/*
|--------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions app/config/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* conjoon
* php-ms-imapuser
* Copyright (C) 2019-2021 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
* lumen-app-email
* Copyright (c) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/lumen-app-email
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
4 changes: 2 additions & 2 deletions app/config/cors.php.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* conjoon
* php-ms-imapuser
* Copyright (C) 2019-2021 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
* lumen-app-email
* Copyright (c) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/lumen-app-email
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
Loading

0 comments on commit 10959be

Please sign in to comment.