Skip to main content

ScriptHooks

Trait ScriptHooks 

Source
pub trait ScriptHooks {
    // Required methods
    fn pre_cmd(&self) -> Result<()>;
    fn pre_autoload_dump(&self) -> Result<()>;
    fn post_autoload_dump(&self) -> Result<()>;
    fn post_cmd(&self) -> Result<()>;
}
Expand description

Lifecycle hooks fired during an install when root-script execution is opted in. The installer stays command- and PHP-agnostic: the caller supplies an implementation that maps each hook to the right Composer event (pre-install-cmd vs pre-update-cmd, …) and runs it.

Some(hooks) is the scripts-ON gate: when present, the native Laravel discovery + its drift guard are skipped (the real post-autoload-dump entries run instead), and the “scripts not run” warning is suppressed. None keeps the deterministic scripts-OFF behavior.

Required Methods§

Source

fn pre_cmd(&self) -> Result<()>

pre-install-cmd / pre-update-cmd — before package operations.

Source

fn pre_autoload_dump(&self) -> Result<()>

pre-autoload-dump — before the autoloader is regenerated.

Source

fn post_autoload_dump(&self) -> Result<()>

post-autoload-dump — after the autoloader is regenerated. Runs the project’s real entries (e.g. Laravel’s package:discover).

Source

fn post_cmd(&self) -> Result<()>

post-install-cmd / post-update-cmd — at the very end.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§