Skip to content

joeltiago00/poc-raw-php-serverless-application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐘 POC | Raw PHP Application + AWS Serverless Deploy

This is a proof of concept (POC) application to demonstrate how to configure Serverless deployment with raw PHP.

In this project, I'm using the Bref and the Serverless Framework (AWS) with Node.js.

My objective is to show how you can configure your raw PHP application, rather than to implement the most beatiful code (kekw). Obviously, this configuration can be applied to PHP applications using any framework, although some settings may differ.

The application consists of checking if an email domain is valid. I'm using mock data to simulate blocked domains, just as an example to demonstrate how it works.

Configure Deployment

Prerequisites

  1. Node.js and NPM: Ensure that Node.js and NPM are installed in your environment.

  2. AWS Account: You need an AWS account and an IAM user with the necessary credentials. If you don't know how to set this up, you can see the AWS IAM documentation.

Installation

1. Install Bref Plugin

Install the Bref plugin as a dependency using Composer:

composer require bref/bref --update-with-dependencies

2. Install Serverless Framework

Install the Serverless Framework using NPM. Here’s how to install:

npm install -g serverless

3. Configure Serverless Credentials

Assuming you already have the necessary AWS credentials, configure them using the Serverless Framework. Run:

serverless

Select option Skip Adding An App.

plot

Chose Save AWS Credentials in a Local Profile and provide your access key and secret key to finalize the configuration.

plot

4. Deployment

Deploy your application with:

serverless deploy

plot

And you’re all set!

Notes

Setup Locally Application

Please ensure that Docker is installed on your local machine.

1. Building container

To build the container, execute:

docker compose up -d

2. Execute bash as root user:

To access the container as root, use:

docker compose exec -uroot app bash

3. Config your serverless credentials

Configure the Serverless Framework by using:

serverless

Select the option Skip Adding An App.

plot

Chose Save AWS Credentials in a Local Profile and provide your access key and secret key to complete the configuration.

plot

4. Deploy Application

To made deploy application, just run:

serverless deploy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published