PHPackages                             georgebuilds/livewire-molecule - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. georgebuilds/livewire-molecule

ActiveLibrary

georgebuilds/livewire-molecule
==============================

A Laravel Livewire component for 3D molecular visualization using 3DMol.js

v2.1.0(2mo ago)052MITPHPPHP ^8.2CI passing

Since Dec 30Pushed 1mo agoCompare

[ Source](https://github.com/georgebuilds/livewire-molecule)[ Packagist](https://packagist.org/packages/georgebuilds/livewire-molecule)[ RSS](/packages/georgebuilds-livewire-molecule/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (12)Versions (11)Used By (0)

Livewire Molecule
=================

[](#livewire-molecule)

A Laravel Livewire component for 3D molecular visualization powered by [3DMol.js](https://3dmol.csb.pitt.edu/)

[![Molecule visualization](./.github/molecules.png)](./.github/molecules.png)

Features
--------

[](#features)

- 🧪 Multiple input formats: SMILES, InChI, PDB ID, PubChem CID, or raw SDF data
- 🎨 Multiple visualization styles: stick, sphere, cartoon, line, ball-and-stick
- 🔄 Three display modes: interactive, rotating, static
- ⚡ Reactive updates with Livewire
- 🎯 Automatic 3D coordinate generation from SMILES/InChI

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12, or 13
- Livewire 4.x *(requires Laravel 11+)*
- Alpine.js (included with Livewire)

Installation
------------

[](#installation)

```
composer require georgebuilds/livewire-molecule
```

Optionally publish the config file:

```
php artisan vendor:publish --tag=molecule-config
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
{{-- From SMILES notation --}}

{{-- From PDB ID --}}

{{-- From PubChem CID --}}

{{-- From InChI --}}

{{-- From raw SDF data --}}

```

### Display Modes

[](#display-modes)

```
{{-- Interactive (default) - user can rotate/zoom --}}

{{-- Rotating - auto-rotates on Y axis --}}

{{-- Static - no interaction --}}

```

### Visualization Styles

[](#visualization-styles)

```

 {{-- Best for proteins --}}

```

### Customizing Appearance

[](#customizing-appearance)

```

```

### Advanced 3Dmol Options

[](#advanced-3dmol-options)

Pass additional 3Dmol.js options through the Livewire wrapper:

```

```

### Reactive Updates

[](#reactive-updates)

The component reacts to property changes:

```

        Ethanol
        Acetic Acid
        Benzene

```

Configuration
-------------

[](#configuration)

```
// config/livewire-molecule.php

return [
    // Default background color
    'default_background' => '#ffffff',

    // HTTP timeout for external APIs (seconds)
    'timeout' => 10,

    // Default 3Dmol.js options
    'viewer_options' => [],
    'model_options' => [],
    'style_options' => [],

    // Cache settings for resolved molecules
    'cache' => [
        'enabled' => true,
        'ttl' => 60 * 60 * 24, // 24 hours
        'prefix' => 'molecule_',
    ],
];
```

Input Format Priority
---------------------

[](#input-format-priority)

When multiple identifiers are provided, the component uses this priority:

1. `sdf` (raw data, no API call needed)
2. `pdb` (fetches from RCSB PDB)
3. `pubchem-cid` (fetches from PubChem)
4. `smiles` (converts via NCI CACTUS)
5. `inchi` (converts via NCI CACTUS)

External APIs Used
------------------

[](#external-apis-used)

This package relies on these free public APIs for structure retrieval and conversion:

APIPurposeRate Limits[RCSB PDB](https://www.rcsb.org/)Fetch protein structuresGenerous[PubChem](https://pubchem.ncbi.nlm.nih.gov/)Fetch compound structures5 req/sec[NCI CACTUS](https://cactus.nci.nih.gov/)SMILES/InChI → 3D conversionBest effortFor production use with high traffic, consider implementing your own conversion service or caching aggressively.

Troubleshooting
---------------

[](#troubleshooting)

### "Failed to convert SMILES to 3D structure"

[](#failed-to-convert-smiles-to-3d-structure)

- Verify the SMILES string is valid
- The NCI CACTUS service may be temporarily unavailable
- Some complex molecules may fail to convert

### Molecule appears blank

[](#molecule-appears-blank)

- Check browser console for JavaScript errors
- Ensure 3DMol.js is loading (check Network tab)
- Verify the molecule data is being resolved (check `$moleculeData` property)

### "Cannot connect to \[API\]" or blank molecule in production

[](#cannot-connect-to-api-or-blank-molecule-in-production)

**This package requires outbound HTTP access** to external APIs for SMILES/InChI conversion and PubChem/PDB data fetching.

**Laravel Vapor**: Enable outbound HTTP in your `vapor.yml`:

```
id: your-project-id
name: your-project-name
environments:
  production:
    egress: true  # Enable outbound HTTP
```

**Other platforms**: Ensure your server/firewall allows outbound HTTPS to:

- `cactus.nci.nih.gov` (SMILES/InChI conversion)
- `pubchem.ncbi.nlm.nih.gov` (PubChem data)
- `files.rcsb.org` (PDB structures)
- `3dmol.csb.pitt.edu` (3DMol.js CDN)

**Workaround**: Use raw SDF/PDB data instead of SMILES/PubChem CIDs to avoid external API calls:

```

```

Upgrade Guide (v1 → v2)
-----------------------

[](#upgrade-guide-v1--v2)

v2 renames the publishable config file and config key.

1. Republish config:

```
php artisan vendor:publish --tag=molecule-config
```

2. Update config usage:

- File moved from `config/molecule.php` to `config/livewire-molecule.php`
- Config key changed from `molecule` to `livewire-molecule`

If you referenced config values in your app, update:

```
// v1
config('molecule.default_background');

// v2
config('livewire-molecule.default_background');
```

Local Development
-----------------

[](#local-development)

To preview the component in a real browser while working on the package:

```
composer serve
```

Then open  to see a live demo page with multiple molecule examples rendered using the actual component.

Testing
-------

[](#testing)

```
composer test
```

Acknowledgments
---------------

[](#acknowledgments)

- [3DMol.js](https://3dmol.csb.pitt.edu/) - BSD-3-Clause licensed molecular viewer
- [NCI CACTUS](https://cactus.nci.nih.gov/) - Chemical structure conversion service
- [PubChem](https://pubchem.ncbi.nlm.nih.gov/) - Chemical compound database

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

This package includes 3DMol.js which is licensed under BSD-3-Clause.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance90

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Recently: every ~19 days

Total

8

Last Release

61d ago

Major Versions

v1.0.1 → v2.0.02026-01-28

PHP version history (2 changes)v1.0.0-beta.1PHP ^8.1

v2.0.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/95251e32b761019134124c90282e8f7b72b60fae2fc8ea588baf217c74173120?d=identicon)[georgebuilds](/maintainers/georgebuilds)

---

Top Contributors

[![georgebuilds](https://avatars.githubusercontent.com/u/126706069?v=4)](https://github.com/georgebuilds "georgebuilds (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

composerlaravellivewirelaravellivewirevisualizationmoleculesmileschemistry3dmolinchiatoms

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/georgebuilds-livewire-molecule/health.svg)

```
[![Health](https://phpackages.com/badges/georgebuilds-livewire-molecule/health.svg)](https://phpackages.com/packages/georgebuilds-livewire-molecule)
```

###  Alternatives

[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[calebdw/larastan-livewire

A Larastan / PHPStan extension for Livewire.

43482.4k3](/packages/calebdw-larastan-livewire)[mati365/ckeditor5-livewire

CKEditor 5 integration for Laravel Livewire

413.9k](/packages/mati365-ckeditor5-livewire)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)[mwguerra/web-terminal

A web-based terminal component for Filament/Laravel with command whitelisting and multiple connection types

251.1k](/packages/mwguerra-web-terminal)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
