Generating your first report | lighthouse-rust | Spatie      

 SPATIE  

lighthouse-rust
===============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Lighthouse-rust](https://spatie.be/docs/lighthouse-rust/v1)  Usage  Generating your first report

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/lighthouse-rust/v1) 

  Generating your first report    
- [ Introduction ](https://spatie.be/docs/lighthouse-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/lighthouse-rust/v1/support-us)
- [ Requirements ](https://spatie.be/docs/lighthouse-rust/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/lighthouse-rust/v1/installation-setup)
- [ Testing ](https://spatie.be/docs/lighthouse-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/lighthouse-rust/v1/changelog)

Usage
-----

- [ Generating your first report ](https://spatie.be/docs/lighthouse-rust/v1/usage/generating-your-first-report)
- [ Configuring a run ](https://spatie.be/docs/lighthouse-rust/v1/usage/configuring-a-run)
- [ Working with results ](https://spatie.be/docs/lighthouse-rust/v1/usage/working-with-results)
- [ Saving an HTML report ](https://spatie.be/docs/lighthouse-rust/v1/usage/saving-an-html-report)
- [ Using performance budgets ](https://spatie.be/docs/lighthouse-rust/v1/usage/using-performance-budgets)

 Generating your first report
============================

With the package installed, this is how you can run Lighthouse.

```
use spatie_lighthouse::Lighthouse;

let result = Lighthouse::url("https://example.com")?.run()?;
```

You can use the `scores()` method to get scores of the four categories Lighthouse runs audits for.

```
let scores = result.scores();
// For example: {"accessibility": 92, "best-practices": 100, "performance": 100, "seo": 91}
```

Here's how you can get the results of an audit:

```
let audit = result.audit("first-contentful-paint")?;
// The audit includes id, title, score, numericValue, numericUnit and displayValue.
```

To get the results of all audits, call `audits()`. It returns the report's audit map, or `None` if you restored a report without audits. The result examples use the PHP package's saved example.com report; real scores vary by page, browser version and machine.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
