This project implements a feedback application allowing the user to
- Import a CSV file containing feedback from Feedier on an hourly basis through a CRON job
- Create a feedback entry through a form
- Export all feedback as a JSON file and send it to all the admin users every Friday at 3pm, through a CRON job
- Import feedback manually with a JSON or CSV file if logged in
-
Clone the repository:
git clone git@github.com:tamglaeser/feedbackapp.git
-
Navigate to the project directory:
cd feedbackapp
-
Install PHP dependencies:
composer install
-
Install Node.js dependencies:
npm install
-
Generate application key:
php artisan key:generate
-
Compile assets:
npm run dev
To start the development server, run:
php artisan serve
You can now open http://localhost:8000 to see the application.
feedbackapp/
│
├── app/ # Contains core application code (controllers, models, etc.)
│ ├── Console/ # Artisan console commands
│ │ ├── Commands/ # Contains implementation of my two CRON commands
│ │ ├── Kernel.php # Contains scheduler of CRON commands
│ ├── Exceptions/ # Exception handling
│ ├── Http/ # Controllers, middleware, requests
│ ├── Mail/ # Mailables
│ ├── Models/ # ie. Feedback, User
│ ├── Providers/ # Service providers
│ └── Services/
│
├── bootstrap/ # Bootstrapping and application startup
│ └── ... # Framework initialization files
│
├── config/ # Configuration files for various application components
│ └── ... # Files such as database, services, app settings, etc.
│
├── database/ # Database-related files
│ ├── migrations/ # Database migration files to create / modify tables
│ └── seeds/ # Database seeders
│
├── public/ # Publicly accessible files served by the webserver
│ └── ... # Assets, index.php, etc.
│
├── resources/ # Views, language files, and frontend assets
│ ├── js/ # Vue components, app.js
│ ├── views/ # Blade templates/views
│ └── ... # Other assets, such as CSS
│
├── routes/ # Route definitions for the application
│ └── ... # Web.php, API.php, etc.
│
├── storage/ # Storage for logs, file uploads, and other temporary files
│ ├── app/ # Files generated by the application
│ ├── framework/ # Framework-generated files
│ └── ... # Other storage-related items
│
├── .env # Environment-specific configuration file
├── .gitignore # Files and directories ignored by version control
├── artisan # Laravel's command-line interface executable
├── composer.json # Defines PHP dependencies for the Laravel application
├── package.json # Node.js dependencies and scripts (if present)
└── ... # Other project-related files and folders
Using SQLite as my database; find under database/database.sqlite
. See configurations within the .env
file.
Using Mailtrap as "dummy" mailbox to test my email sending. Configurations can be found in .env
file; modify the host,
username, password, and other configurations to set up with your own Mailtrap account. Will then be able to see the sent
emails in your Mailtrap inbox, including the To and From addresses, content, and attachments.
Using Sentry to capture exceptions or messages as events. Replace SENTRY_LARAVEL_DSN
(currently
set to null
) in the .env
file to your Sentry Laravel DNS to see the events on your Sentry account.
To set up CRON to call the Laravel command scheduler every minute, running the commands when scheduled, execute
php artisan schedule:run >> /dev/null 2>&1
This will ensure steps 1 and 3 of this application are processed, importing feedback data from Feedier every hour and sending feedback data to admin users every Friday at 3pm.
To see all available commands provided by Artisan, execute
php artisan list
The two schedule CRON jobs can be found here as commands:
php artisan csv:process # Import Feedier CSV file
php artisan export:feedback # Export feedback as JSON and send it to admin users
To set up my certificate for my first CRON job - importing the Feedier CSV file - and avoid an SSL error, I had to
download the latest cURL bundle of all the CAs (which includes the Amazon one), and add the path of this cacert.pem
as my php.ini
openssl.cafile
variable. In case the Amazon CA were missing from this file, I could download the
certificate from the Feedier Production Site and add the CA
to the cacert.pem
.