Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Comment améliorer le quotidien des Développeurs PHP ?

716 views

Published on

Conférence présentée lors du summer meetup de l'AFUP à Limoges le 19 juin 2018. Son objectif est de présenter plusieurs outils permettant de gagner rapidement en efficacité au quotidien.

Published in: Technology
  • J'ai remarqué qu'une petite boulette s'était glissée dans mon slide avec l'exemple de Git hook... Du coup, voici un lien vers un gist avec la version corrigée. https://gist.github.com/ajardin/da187e281f6602114dfece5a690251db
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Comment améliorer le quotidien des Développeurs PHP ?

  1. 1. Comment améliorer le quotidien des Développeurs PHP ?
  2. 2. hello! Alexandre Jardin Senior Back-end Developer @EmakinaFR
  3. 3. Most Common Problems Local environment used for development not reliable Same commands used again and again every day Too much time spent by the team when reviewing the code
  4. 4. 1. Docker Let’s start with your computer
  5. 5. Containers VS Virtual Machines
  6. 6. Why?
  7. 7. Multiple projects = Multiple configurations
  8. 8. Resources used by VMs
  9. 9. How?
  10. 10. docker-compose.yml “apache” service on port 443 with a shared volume for project code “mysql” service on port 3306 with a persistent volume for databases
  11. 11. Dockerfile Base Custom packages Custom configuration
  12. 12. Migration from PHP 5.6 to PHP 7.2 -FROM php:5.6-fpm +FROM php:7.2-fpm docker-php-ext-install -j$(nproc) […] - mcrypt […] + yes "" | pecl install apcu-4.0.11 lzf mongo redis && + docker-php-ext-enable apcu lzf mongo redis && - yes "" | pecl install apcu lzf mongodb redis && - docker-php-ext-enable apcu lzf mongodb redis &&
  13. 13. Symfony Recipes ✘ Docker support in progress ✘ Environment managed by the community ✘ Symfony + Composer + Docker = https://github.com/symfony/flex/pull/128
  14. 14. Summary ✘ Same environment for each developer ✘ Can be shared with the project source ✘ Light & Fast! Less time wasted on your environment, more time to develop things.
  15. 15. 2. Code Styles Focus on substance over form
  16. 16. Why?
  17. 17. “Programs must be written for people to read, and only incidentally for machines to execute. Abelson & Sussman
  18. 18. How?
  19. 19. PHP-CS-Fixer
  20. 20. ESLint
  21. 21. Summary ✘ Code more readable ✘ Commits more relevant ✘ Code (sometimes) more efficient No matter what rules you choose, consistency is the key.
  22. 22. 3. Static Analysis How about (almost) automate the code review?
  23. 23. Why?
  24. 24. Time spent by developers from Codacy studies Code review
  25. 25. How?
  26. 26. IDE real-time analysis
  27. 27. PHP Static Analysis Tool (PHPStan)
  28. 28. Symfony Linters ✘ Built-in commands ✘ Are able to detect syntax errors ✘ Almost instant
  29. 29. External Services ✘ Codacy ✘ Scrutinizer ✘ SonarQube ✘ SensioLabsInsight ✘ ...
  30. 30. Codacy Dashboard Bitbucket integration
  31. 31. Summary ✘ Better autonomy of team members ✘ Positive impact on the overall project quality ✘ Nice learning process Free or Premium? Choose one or both, it's a must-have!
  32. 32. 4. Security Audits Are you sure your dependencies are secure?
  33. 33. Why?
  34. 34. Composer = Tons of dependencies
  35. 35. 83,245,467Number of composer.lock files checked since 2014 22,106,532Total number of vulnerabilities found 7,294,964 = 9%Number of composer.lock files with known vulnerabilities
  36. 36. How?
  37. 37. Roave Security Advisories or SensioLabs Security Checker
  38. 38. Symfony Security Monitoring
  39. 39. Summary ✘ Easy to integrate ✘ Maintained by the community ✘ Can be part of a “quality package” Nobody wants a security breach in its application...
  40. 40. 5. Makefile Let's automate a few things
  41. 41. Why?
  42. 42. Daily work = Tons of commands
  43. 43. Bash aliases
  44. 44. How?
  45. 45. Overview
  46. 46. Summary ✘ Shared with the project source ✘ Easy to write/maintain ✘ Can be used to share knowledge Tired of writing a command over and over? Add it in your Makefile!
  47. 47. 6. Git Hooks Still too many commands?
  48. 48. Why?
  49. 49. Makefile = Fewer commands
  50. 50. How?
  51. 51. Default templates
  52. 52. “commit-msg” example
  53. 53. Summary ✘ Can perform additional checks ✘ Can trigger additional processes ✘ Work with any programming language With custom hooks, Git can fit nearly any workflow you can imagine.
  54. 54. 7. Blackfire Because performance matters
  55. 55. Why?
  56. 56. “53% of users abandon a website that takes more than 3 seconds to load. Google studies
  57. 57. Clean code !== Fast code
  58. 58. How?
  59. 59. Profile example
  60. 60. Metrics/Tests example
  61. 61. Scenarios example
  62. 62. Real examples from a legacy project
  63. 63. Summary ✘ Very easy to install and use ✘ Performance profiling and recommendations ✘ Can also be used for non-regression testing Before upgrading your infrastructure, have a look to Blackfire!
  64. 64. “Never stop measuring” Nicolas Grekas
  65. 65. Overview Docker Code Styles Static Analysis Security MakefileGit HooksBlackfire
  66. 66. thanks! Any questions? Email: info@ajardin.fr GitHub: ajardin // Twitter: alxjrdn

×