If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Setting Up a PHP Development Environment

Started by tvalexndar, Jun 05, 2024, 12:25 AM

Previous topic - Next topic

tvalexndarTopic starter

Next week, I'm planning to dive into learning php, and my approach will be to get hands-on by setting up the development environment.
So, I'm curious - what are the essential tools that make up a modern php developer's environment today? I'm sure there are opinions on advanced IDEs that come with a plethora of built-in tools. However, my preference is to personally configure everything, even though I already have PhpStorm installed.



Oh, and I'm sticking with Windows for now. I've heard about OpenServer as a great alternative to LAMP, but it's been a while since I last used it. Maybe there are newer options worth exploring.
Any recommendations or insights on this journey into php development?
  •  


Nizam18

When it comes to creating a local development environment, XAMPP is a versatile solution for Windows users. It bundles Apache, MySQL, PHP, and Perl in an easy-to-install package, providing a comprehensive LAMP stack for local development. This empowers you to develop and test PHP applications within a controlled environment before deploying them to a live server.

In addition to XAMPP, Composer is a fundamental tool for PHP dependency management. It simplifies the process of integrating external libraries and packages into your projects, streamlining the development and maintenance of PHP applications.

For coding and development, PhpStorm is a feature-rich IDE that offers extensive support for PHP, including advanced code completion, debugging capabilities, and seamless integration with version control systems. However, if you prefer a lightweight and customizable text editor, Visual Studio Code is an excellent alternative, offering a myriad of extensions to enhance PHP development, such as the PHP Debug extension for seamless debugging.

Version control is a vital aspect of modern software development, and Git is the de facto standard for version control. By incorporating Git into your workflow and utilizing platforms like GitHub or GitLab for repository hosting, you'll be well-equipped to manage and collaborate on your PHP projects effectively.

Regarding OpenServer, while it has been a popular choice in the past, it's worth exploring newer alternatives to ensure you're leveraging the most recent features and improvements in local development tools.
As you embark on your PHP development journey, carefully configuring a robust local development environment with tools like XAMPP, Composer, and a suitable code editor will lay a solid foundation for your learning and future projects. Embracing a healthy balance between personalized configuration and the utilization of dependable tools will optimize your productivity and efficiency as a PHP developer on Windows.
  •  

langergrp

Here are the tools I typically use and why.

1. container environment
(90% of the time, php -S 0.0.0.0:8000 suffices for web development)
virtual machines are needed:
- when the host system gets cluttered and needs frequent reinstallation
- when working on multiple projects with different environment requirements (php, web server, database)
- to avoid compatibility issues within a team

2. git version control system
Let the machine, not a person, keep track of your changes.
It's important:
- to prevent losing a year's worth of work with a single delete command
- to identify who caused issues within a team
- to easily transfer project versions between machines

3. composer for managing php packages
Useful for lazily downloading and connecting php libraries at startup

4. behat + phpspec
Tests are essential:
- for peace of mind and sound sleep, free from nightmares of broken code
- when things go wrong in production
- when implementing new features leads to new bugs

5. zsh
A good command line interface boosts productivity.
The command line is essential to work - life is the shell.

6. tmux
One console window is never enough - tmux comes to the rescue.
A bonus: enables pair programming for free

7. tmuxinator
Tired of opening multiple tmux windows every time? Try tmuxinator.

8. vim
- Feel like doing something different?
- Want to write code more efficiently?
Open vim. Once you do, you won't be able to close it.
It's addictive with frequent use

9. continuous integration server
Think of it as a pet machine. Feed it good code and see a pleasant green light. Give it bad code and it reacts angrily. Over time, it becomes more skilled and can:
- run 10-minute tests by itself
- prepare and publish the project
- provide insights into your code
It's easy to teach and can learn amazing things.

10. pre-commit hook with various linters
Check your code before it reaches the continuous integration server to avoid feeding it bad products. Don't forget to make git work for you.

11. gulp
Another assistant of yours.
Use it as a file watcher + live preview to forget about hitting F5 in the browser

12. bower
Similar to composer, but for managing assets like jQuery and Bootstrap

. Linux
Even if you don't use it as a primary system, understanding it is essential. Your code will run on it.
  •  

affihy

For years, I've relied on notepad++ for coding. No need for an IDE, just pure manual work))) It may seem tough for some, but I prefer writing code without endless hints and autocompletion. For Linux, I turn to geany.

And when it comes to server setup, I stick to Linux with nginx+phpfpm – not a fan of the Windows approach. Our team swears by sublime, and it does the job just fine.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...