8000 Add ability to customize separator across Onym strategies via options and constructor by SimonBarrettACT · Pull Request #1 · Blaspsoft/onym · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add ability to customize separator across Onym strategies via options and constructor #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SimonBarrettACT
Copy link
@SimonBarrettACT SimonBarrettACT commented Apr 13, 2025

Description

This pull request enhances the Onym package by making the separator used across different strategies fully customizable.

Previously, the timestamp(), date(), and numbered() methods hard-coded the separator (e.g., underscore _) into their generated filenames. There was no way to override it dynamically through options.

This PR introduces:

  • Support for a separator option in all relevant methods (timestamp, date, numbered, and slug).
  • Fallback to a defaultSeparator if no separator is provided in options.
  • The ability to override options and defaultSeparator through the constructor, making the class easier to customize and test.

Example usage:

use Blaspsoft\Onym\Onym;

// Set a custom default separator
$onym = new Onym([], ' ');
$filename = $onym->timestamp('invoice', 'pdf'); // 2024-03-15 invoice.pdf

// Or override per call
$filename = $onym->timestamp('invoice', 'pdf', ['separator' => ' ']); // 2024-03-15 invoice.pdf

@deemonic
Copy link
Collaborator
deemonic commented Apr 13, 2025

Hi @SimonBarrettACT

Thanks for this addition I can see the value.

I just wanted to acknowledge the request I'll try and look as this and get this merged later today. If not it will be Wednesday as im travelling Monday / Tuesday.

I just wanted to let you know and set some expectation.

Your contribution is appreciated

Have a great day

@SimonBarrettACT
Copy link
Author

Would it be possible to merge this please 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0