Best workflow for web dev?

I'm working on a website and just fiddling around with PHP, Javascript, SQL, etc.
But I'm finding it annoying that in order to do anything and publish it "live" (so I can show my friends and use the mysql database on my server) I have to use ftp.
Right now my workflow is just using notepad++, editing a file, then uploading the file to my server using ftp to see how it works with everything.
Is there a more elegant way to do this? What does everyone here do for their work flow?

In regards to dealing with ftp

If you're already using git there is a nice extension for git called git-ftp

On debian you should be able to install it easily with sudo apt install git-ftp
This makes pushing changes to a prod server as easy as git ftp push

Read the configuration README.md on the github page to get started :wink:

As for other aspecs:

  1. I usually use netbeans as my PHP IDE of choice, tons of plugins for lots of php tools and css preprocessor integration of less etc.

  2. I use vagrant to manage virtual machines for software (I have it configured so the libs on them correspond to the versions the hosting provider uses)

  3. git gud with branch management

  4. less as a css processor

  5. SLIM PHP framework for most API/REST/CRUD needs.

  6. Pain and suffering because WebDev sucks :stuck_out_tongue:

1 Like

Git-Flow is a blessing :wink:

Or SASS, or Stylus :stuck_out_tongue: really a matter of taste (and project needs). I used LESS before, but it had less options then SASS back then (I think they are pretty much on par now). Never used Stylus though.

Gotta be really careful with LESS and SASS that you don't get into selector hell though. I've had a few times where I ended up with 10-level deep selectors cause it's really easy to accidentally cascade to hell.

As for IDEs, I really liked Atom from the first time I used it, not using anything else now. For PHP hinting it does need an installed PHP and a plugin though.

Thanks for that git-ftp though, might try it out some day too :slight_smile:

There is an industry dedicated to solving this problem, so don't feel dumb for being frustrated by it.

I agree with the other posts on this thread, use git, learn git, it will help you in the long run even if this is a hobby.

But there was a time where I found git to intimidating and just wanted to write code, thats fine, just understand that you should be aiming toward using git in your next project.
When you do this is a simple and handy script to get you started.

Its from your post if you have a WAMP installed. If you don't do. It installs PHP, MySQL, and Apache so you dev on your laptop and upload when ready.

Assuming your on windows and just want to get small amounts of code to a server, WebDav (yes, everyone who is reading this I've aware its not the 90's) is a great tool for getting small amounts of code on a cpanel server. Its simple to setup and windows has native support it. It shows up as webdisk in cpanel.

I run a docker LEMP stack for most of my stuff. Git is at first an annoying tool, but incredibly valuable to use. I recently bought the Webstorm IDE because frontend/javascript is where I am focusing. I love Webstorm. My other go to is Sublime Text. Also, learn Vim. It is on almost every server in the world.

ftp? what year is this? use ssh. git supports ssh natively.

for local development, run your webserver on a VM (or as dot404 suggested, docker). easy, quick, isolated, reproducible. if you have no idea, check out http://puphpet.com . you can be up and running within an hour.

if you want to "show friends" there is vagrant share, or just ssh to your live server and git pull.

not every webhost (read: almost none) has ssh access.
Not everyone has a VPS or dedicated server...

ssh is not that uncommon. and if your host doesn't have it, you should ditch them. there's absolutely no excuse for a host to not support ssh. and as a web dev shopping for hosts, it should be an absolute requirement.

cost is not an issue, either. a VPS costs as little, or less, than most shared hosting plans. ntm you can turn them off (saving the money) when not in use.

Well, depends on the host of course.

Sometimes in some companies you don't have a choice of hosts though because - as with WAY too many other topics - people calling the shots for the money have no clue, so there's that.

Also most hosts will still support both FTP and SFTP, but not have an actual SSH access. I would guess (but haven't looked at it), that the GIT FTP thing supports both.

It still exists because some shitty hosts don't have ssh. Yes really and they're still really common, git-ftp is a workaround for that. Don't knock it for at least providing that.

Lots are using SFTP and calling it FTP.

The most elegant way to do it is a nice CI (continuous integration) workflow. Ideally, the workflow is something like this:

  • you create an issue for the task, along with an issue branch
  • when you're done, you push the code to the issue branch
  • someone else reviews the code, while the CI server runs tests
  • optionally, the CI might set up a test environment with the code in the issue branch and a sanitized prod db (comes handy with some customers)
  • when the tests pass and the reviewers approve, you merge the feature branch to master
  • the CI rolls out your changes to the production servers one-by-one

Setting up an infrastructure for this is difficult and time consuming. There are some providers who do it for you, but they are usually quite expensive.

That's what I meant :slight_smile: