aniftyco/skeletor

Summon Skeletor's minion: a Composer companion to unleash extra functionality with every `create-project` command.
1,832 96
Install
composer require aniftyco/skeletor
Latest Version:v0.1.1
PHP:^8.1
License:MIT
Last Updated:Mar 12, 2025
Links: GitHub  ·  Packagist
Maintainer: joshmanders

Skeletor

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

Installation

composer install --dev aniftyco/skeletor

Usage

Make sure the following is set in the scripts section of composer.json:

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

Then just create a Skeletorfile.php in the root with this:

<?php

use NiftyCo\Skeletor\Skeletor;

return function (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 task
    return true;
});
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 your SkeletorFile.php function, Skeletor will execute it after running its cleanup phase to do any additional cleanup or actions you deem necessary. For example:


return function (Skeletor $skeletor) {
    // ...

    return function() use ($skeletor) {
        $skeletor->exec(['git', 'init']);
        $skeletor->exec(['git', 'commit', '-am', '"initial commit"']);
    };
};

Related Packages

padosoft/laravel-composer-security

Security checker for composer.lock.

4,105 31
dredumont/skeleton

Laravel Skeleton

30
mortenscheel/tracer

A PHP library for advanced stack trace handling and debugging.

13,486 0
mortenscheel/laravel-query-recorder

A package to record and analyze database queries in Laravel applications.

13,283 1
avido/package-generator

Generate Skeleton for Concord Module/Package

5,917 0

Version History

Version Released PHP License
v0.1.1 ^8.1 MIT
v0.1.0 ^8.1 MIT