Sublime Forum

Sublime Text 4 - PHP: how to generate setters/getters (or accessors/mutators) for a PHP class

#1

Hello,

first of all, i would like to share my love for Sublime Text, this amazing editor i have been using for many years.

It provides a lot of features, and coupled with LSP, it becomes an outstanding IDE without claiming at least 16 Go of RAM or an 99-cores CPU with a GPU with 16 Go !!! :stuck_out_tongue:

As you can guess, i would never change my precious ^^

But. (yes thereā€™s always a but ^^)

I have been looking for a way (plugin, snippet, etc) to easily generate getter and setter of an attribute of a PHP class.

I have noticed some plugins like the well-named ā€œPHP getters settersā€ but it is outdated et seems not to work anymore.

There is also ā€œPHP FMTā€ but it is not working too: it only generates the constructor ^^ā€™.

So i would like to know if you have any solution or advice that could help me.

Thank you !

0 Likes

#2

PHP Getter and Setters_ just seems to stumble over PHP 7.4+ type hints, which a PR with a fix already exists for.

Checkout: https://github.com/deathaxe/sublime-php-getters-setters

1 Like

#3

Thank you @deathaxe for your help. :pray:

I hope this PR will be merged soon.

0 Likes