Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Summon Skeletor's minion: a Composer companion to unleash extra functionality with every `create-project` command.

License

NotificationsYou must be signed in to change notification settings

aniftyco/skeletor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summon Skeletor's minion: a Composer companion to unleash extra functionality with everycreate-project command.

Installation

composer install --dev aniftyco/skeletor

Usage

Make sure the following is set in thescripts section ofcomposer.json:

"post-create-project-cmd": ["NiftyCo\\Skeletor\\Runner::execute"],

Then just create aSkeletorfile.php in the root with this:

<?phpuseNiftyCo\Skeletor\Skeletor;returnfunction (Skeletor$skeletor) {// ...};

Skeletor API

Metadata About Project

Workspace

$skeletor->workspace

Gathering User Input

Text Input

$skeletor->text('Enter your name:','John Doe');

Textarea Input

$skeletor->textarea('Enter a description:');

Password Input

$skeletor->password('Enter your password:');

Confirm

$skeletor->confirm('Do you agree?',true);

Select

$skeletor->select('Choose an option:', ['Option 1','Option 2','Option 3']);

Multiselect

$skeletor->multiselect('Choose multiple options:', ['Option 1','Option 2','Option 3']);

Suggest

$skeletor->suggest('Start typing:', ['Suggestion 1','Suggestion 2','Suggestion 3']);

Search

$skeletor->search('Search for an option:',function ($query) {return ['Result 1','Result 2','Result 3'];});

Multisearch

$skeletor->multisearch('Search for multiple options:',function ($query) {return ['Result 1','Result 2','Result 3'];});

Displaying Information

Spinner

$skeletor->spin('Processing...',function () {// long running taskreturntrue;});

Progress Bar

$skeletor->progress('Processing items...',100,function ($progress) {for ($i =0;$i <100;$i++) {$progress->advance();    }});

Messages

$skeletor->info('This is an info message.');$skeletor->alert('This is an alert message.');$skeletor->warning('This is a warning message.');$skeletor->error('This is an error message.');$skeletor->intro('Welcome to the setup wizard.');$skeletor->outro('Setup complete.');

File Operations

Reading a File

$skeletor->readFile('path/to/file.txt');

Writing to a File

$skeletor->writeFile('path/to/file.txt','New content');

Removing a File

$skeletor->removeFile('path/to/file.txt');

Removing a Directory

$skeletor->removeDirectory('path/to/directory');

Checking if a File Exists

$skeletor->exists('path/to/file.txt');

Updating composer.json

$skeletor->updateComposerJson(['require' => ['new/package' =>'^1.0']]);

Executing a Command

$skeletor->exec(['ls','-la']);

Table

$skeletor->table(['Header 1','Header 2'], [['Row 1 Col 1','Row 1 Col 2'], ['Row 2 Col 1','Row 2 Col 2']]);

Pause

$skeletor->pause(5);

Replace In File

$skeletor->replaceInFile('search string','replace string','path/to/file.txt')

Preg Replace In File

$skeletor->pregReplaceInFile('/pattern/','replace string','path/to/file.txt');

Post-Cleanup Hook

If you return a function from yourSkeletorFile.php function, Skeletor will execute it after running its cleanup phase to do any additional cleanup or actions you deem necessary. For example:

returnfunction (Skeletor$skeletor) {// ...returnfunction()use ($skeletor) {$skeletor->exec(['git','init']);$skeletor->exec(['git','commit','-am','"initial commit"']);    };};

About

Summon Skeletor's minion: a Composer companion to unleash extra functionality with every `create-project` command.

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp