Download the PHP package allyson/laravel-safe-mode without Composer

On this page you can find all versions of the php package allyson/laravel-safe-mode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-safe-mode

allyson/laravel-safe-mode

PHP Laravel

Protege ambientes Laravel contra execução acidental de comandos Artisan destrutivos em produção — com auditoria completa, notificações e whitelist de IPs.


O problema que essa lib resolve

Isso já aconteceu em empresas grandes. O SafeMode impede.


Como funciona

Em ambos os casos com host remoto, o banco de auditoria precisa estar disponível. Se não estiver, o comando é bloqueado incondicionalmente.


Instalação

O Service Provider é registrado automaticamente via Laravel Package Auto-Discovery.

Configuração inicial

O assistente irá:

  1. Publicar config/safe-mode.php
  2. Publicar as migrations
  3. Perguntar qual conexão usará para salvar as auditorias
  4. Atualizar o .env automaticamente
  5. Executar as migrations (opcional)

Variáveis de ambiente

Variável Padrão Descrição
SAFE_MODE true true = bloqueia em servidor remoto | false = audita sem bloquear
SAFE_MODE_AUDIT_CONNECTION (vazio) Nome da conexão do banco de auditoria
SAFE_MODE_FORCE_PRODUCTION true Força safe mode quando APP_ENV=production
SAFE_MODE_ALLOWED_IPS (vazio) IPs adicionais considerados locais (separados por vírgula)
SAFE_MODE_WEBHOOK_ENABLED false Habilita notificações via webhook
SAFE_MODE_WEBHOOK_CHANNEL generic Canal: slack, discord ou generic
SAFE_MODE_WEBHOOK_URL (vazio) URL do webhook

Exemplo de .env:


Configuração (config/safe-mode.php)


Tabela de auditoria (safe_mode_audits)

Campo Tipo Descrição
id bigint Chave primária
command string Comando executado (ex: migrate:fresh)
user string Usuário do SO (PHP process)
machine string Hostname da máquina
ip string IP da máquina
database_host string Host do banco alvo
connection string Nome da conexão Laravel
app_env string APP_ENV no momento
output longtext Saída do comando (quando capturada)
exit_code integer Código de saída
blocked boolean true = bloqueado, false = auditado
created_at timestamp Data/hora do registro

Detecção de host local

O LocalIpDetector considera local:


Adicionar comandos à lista de proteção


Notificações via Webhook

Slack

Discord

HTTP Genérico (JSON)

Payload enviado:


Estrutura do pacote


Requisitos


Licença

MIT — veja LICENSE.

Estrutura final


Decisões de design implementadas

Requisito Implementação
Bloquear migrate:fresh etc. em host remoto SafeModeService via CommandStarting event
SAFE_MODE=false audita sem bloquear Fluxo no SafeModeService.handle()
Banco de auditoria obrigatório ConnectionInspector.assertAuditConnectionAvailable() — sem banco, bloqueia sempre
safe-mode:install interativo InstallCommand com seleção de conexão, testes, atualização do .env
Forçar safe mode em APP_ENV=production force_on_production na config
Whitelist de IPs extras SAFE_MODE_ALLOWED_IPS + LocalIpDetector.isWhitelisted()
Notificações webhook WebhookNotifier para Slack, Discord e HTTP genérico
SQLite sempre local ConnectionInspector verifica driver antes do host
blocked vs audited separados Campo blocked boolean na tabela + método registerBlocked()

All versions of laravel-safe-mode with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
illuminate/support Version ^12.0
illuminate/console Version ^12.0
illuminate/database Version ^12.0
illuminate/events Version ^12.0
illuminate/http Version ^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package allyson/laravel-safe-mode contains the following files

Loading the files please wait ...