1

Building a job offer app with MailChimp and Symfony

 2 years ago
source link: https://devm.io/php/job-app-mail-chimp-symfony
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

We are hiring!

Building a Job Offer App With Mailchimp and Symfony

03. Aug 2022


In this article, you’ll learn how to build a Single Command Application that interacts with MailChimp and GoogleSpreadsheets using the Symfony Framework. You’ll also learn how to structure your applications to survive changes to the vendor environment.

It all started with a perfectly innocent question: “Hey! You teach PHP, don’t you? You probably know a couple of good PHP devs, right?” And as a matter of fact, I do. Actually, I know quite a lot of them… well, perhaps know is a little too big of a word, let’s just say I have access to many. The first few times I’d simply reply with: “Gee… I don’t really know of anyone in particular but if you want I’m ok with sharing your message with my 1000+ subscribers on your behalf”. Needless to say, the answer was always some variation of “Awesome!”.

So there I was with yet another task on my to-do… And let me tell you, I was not exactly idle to begin with. Move forward a couple of months and I had a choice: I could have ignored the requests altogether or do the honorable thing and build myself a little script that could take care of the heavy lifting for me. And, as you might imagine since you’re reading this, I took the second route. And it was kind of fun too.

I’m not going to go into all of the details of setting up a Google Form, a Mailchimp template, and all of those boring parts and jump straight into the juicy part: how I put it all together into a nice CLI tool that can be easily mounted upon a cronjob and make the world a better place.

Before we go any further, here’s the project’s repository for your reference. Start by cloning it so you can follow along:

git clone https://github.com/mchojrin/job_offers.git

Tools featured in this post

To avoid annoying inconsistencies between deployment environments I used Docker to keep everything within a container, meaning, in order to run the application on your machine, you’ll need it installed. Another tool I used for making the installation process as smoothly as possible is make.

And I believe that pretty much covers the basics needed to get started.

The workflow is this:

  • Someone looking to hire a PHP developer will fill a form on my website
  • The form is connected to a cloud based spreadsheet
  • The main script ./run.sh is called

The script in turn brings up the docker image and runs a Symfony Command.

How to run the application

If you’ve cloned the repository and have Docker installed, these are the steps you need to follow to have the application run:

  1. Get your Mailchimp API-Key from your account:
Fig. 1
  1. Get your API-Key from your Google account
  2. Save the information from Google into credentials.json
  3. sudo make
  4. sudo make install
  5. cp .env.sample .env
  6. Edit the .env file and put your information in there
  7. ./run.sh

But what’s inside the black box?

The entry point

Going from the outside in you’ll find the entry point to the application at run.php. This is just a bootstrap script. It basically takes care of initializing ...


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK