VS Code extension providing code snippets for the StoneScriptPHP framework.
This extension provides a comprehensive set of code snippets for StoneScriptPHP development, including:
stone-route-get- Create a GET route extending BaseRoutestone-route-post- Create a POST route with validationstone-route-contract- Create a route implementing a contractstone-route-health- Create a health check route
stone-model- Create a model classstone-model-method- Add a method to a modelstone-model-create- Add a create methodstone-model-get- Add a get methodstone-model-update- Add an update methodstone-model-delete- Add a delete method
stone-contract- Create a contract interfacestone-contract-route- Create a route contractstone-contract-service- Create a service contractstone-contract-repository- Create a repository contract
stone-dto-request- Create a request DTOstone-dto-response- Create a response DTOstone-dto- Create a generic DTOstone-dto-validated- Create a DTO with validationstone-dto-array-prop- Add an array propertystone-dto-nullable-prop- Add a nullable property
- Install the extension
- Open a PHP file
- Start typing a snippet prefix (e.g.,
stone-route-get) - Press
TaborEnterto insert the snippet - Use
Tabto navigate between placeholders
Type stone-route-get and press Enter:
<?php
namespace App\Routes;
use Framework\Routing\BaseRoute;
use Framework\Http\ApiResponse;
/**
* RouteDescription
*
* Usage:
* GET http://localhost:9100/endpoint
*/
class RouteNameRoute extends BaseRoute
{
/**
* Process the request
*/
public function process(): ApiResponse
{
// Your logic here
return new ApiResponse('ok', 'Success message', [
// Your data here
]);
}
}Type stone-model and press Enter:
<?php
namespace App\Models;
/**
* ModelName Model
*
* Model description
*/
class ModelName
{
/**
* Method description
*
* @param string $param1 Parameter description
* @return array Return description
*/
public static function methodName(string $param1): array
{
global $db;
$stmt = $db->prepare('SELECT * FROM function_name($1)');
$stmt->execute([$param1]);
return $stmt->fetch(\PDO::FETCH_ASSOC) ?: [];
}
}- VS Code 1.80.0 or higher
- PHP development environment
StoneScriptPHP is a lightweight PHP framework designed for building modern APIs with a focus on simplicity and performance.
Contributions are welcome! Please visit the GitHub repository to report issues or submit pull requests.
MIT License - See LICENSE file for details
Initial release with snippets for:
- Routes (GET, POST, with contracts, health checks)
- Models (CRUD operations)
- Contracts (interfaces)
- DTOs (request, response, validated)