Omar Đečević

PHP Developer

@drahil
PHP Laravel PostgreSQL Docker git
Back to Blog

Tailor 0.2.0 - tags, auto saving, auto complete and more

2025-12-14 • 5 min read

I wrote about v0.1.0 in my previous blog and as mentioned there, there were some important features missing from it. In the past month I have been working on them, and v0.2.0 brings some important improvements.

Automatic class discovery

This is one feature from Tinker that was missing in Tailor. In v0.1.0 it was necessary to manually import a class. Now, same as in Tinker, if you type User::first(), class User will be automatically discovered and imported.

However, there is one improvement that fixed a thing that bugs me in Tinker. If you have two classes with the same name you still have to manually import the class to use it. In Tailor, I have used class aliases. Let's say that you have two User classes, one in Models and one in Admin folder. You can use aliases to let Tailor know which class to import:

> ModelsUser::first()
= App\Models\User {#5420
    id: 1,
    name: "Test User",
    email: "test@user.com",
    email_verified_at: null,
    #password: "$2y$12$e7M1Ark08GZqeWmoJQHM..Syip.KMuvhxSm9p9fFwbbsYzHME1FFK",
    #remember_token: null,
    created_at: "2025-11-12 14:42:20",
    updated_at: "2025-12-14 12:50:20",
  }
> AdminUser::first()
= App\Admin\User {#5953
    id: 1,
    name: "Admin User",
    email: "admin@tailor.com",
    email_verified_at: null,
    #password: "$2y$12$jGDdhjeHC3gzXnSGgLg7DO8TSaGHIeEvacx3ay4hm0k1Es0bW5i/G",
    remember_token: null,
    created_at: "2025-12-14 12:49:34",
    updated_at: "2025-12-14 12:49:34",
  }

By default, Tailor scans and imports classes from app directory. You can modify this using configs:

'discovery' => [
    'scannable_namespaces' => [
        'App\\',
    ],
],

Auto saving

This feature aligns well with the original goal of writing Tailor - making sure that no work is ever lost. If auto save is enabled, Tailor will automatically save any session with a minimum of 5 commands or any session longer than 5 minutes. These values are configurable:

'session' => [
    'auto_save' => true,
    'auto_save_interval' => 300, // 5 minutes
    'auto_save_min_commands' => 5, // Minimum commands before auto-save
],

The name of that session is auto-generated:

session-auto-saved-2025-12-14-125052 - 2025-12-14T12:50:52+00:00 (17 commands) [auto-saved]

and it has a [auto-saved] tag.

Auto complete

One more missing feature from Tinker that really bugs me is the lack of autocompletion of Model class methods. This issue inspired me to add it to Tailor. So, if you do:

$user = User::cr<TAB>

it will autocomplete it to create.

Auto complete also works for instance methods.

$user->upd<TAB>

becomes $user->update.

This is a small addition that makes it a bit nicer to work with Tailor and makes life easier.

Tags

One last feature that is added in the new version are tags. Tags are used for better session organization. They can be added when saving and updating the session:

> session:save session-with-tags --tags=test-tag --tags=another-test-tag
✓ Session saved successfully!
  Name:        session-with-tags
  Commands:    3
  Tags:        test-tag, another-test-tag

And sessions can be filtered by tags:

> session:list --tag=test-tag
Saved Sessions:
  session-with-tags - 2025-12-14T15:46:02+00:00 (3 commands) [test-tag, another-test-tag]
  test-tags - 2025-12-13T22:09:06+00:00 (4 commands) [test-tag]

Tags can be useful for grouping sessions by task, bug, or feature when working across multiple debugging sessions.

Conclusion

I am not sure what to add next to Tailor. My goal right now is to make all existing features stable and test everything as much as possible. I am starting a new project this week, and I will install Tailor and use it instead of Tinker to see how it goes.

One thing I still need to decide is how to handle manually saved sessions versus auto-saved ones. Right now, auto-save will override manually saved sessions, and I am not sure if that is the best approach. I guess the more I use it, the better picture I will have.

Tailor is open source and you can check it here: https://github.com/drahil/tailor.