Fold according php ast. Thanks to PHP Parser.
For vim-plug:
Plug 'lvht/phpfold.vim', { 'for': 'php' }
Use zm or :PhpFold to fold the php file.
Set
let g:phpfold_include_surround_blank_lines = 'downward'
if you want to include surround blank lines into each fold. You can set it also to upward
.