switchcat/periodic

Periodic table utility class

v1.0.2 2020-11-13 15:49 UTC

This package is auto-updated.

Last update: 2024-05-14 02:15:34 UTC


README

Twitter Follow Issues GitHub All Releases License: MIT Codacy Badge 68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d537769746368436174266d6573736167653d4672616d65776f726b26636f6c6f723d666637373031267374796c653d666c61742d737175617265


SwitchCat/periodic

Table of Contents

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

Dependencies

Installation

Use composer from the root of your project folder to download the library.

composer require switchcat/periodic

Usage

All method return an array containing either the element's data either an array of elements with their data.

  • Create the periodic object
$Periodic = new \SwitchCat\Periodic\Periodic();
  • Get all elements from the periodic table
$Periodic->getAll();
  • Get an element by name
$Periodic->getElementByName(string $name);
  • Get an element by symbol
$Periodic->getElementBySymbol(string $name);
  • Get an element by number
$Periodic->getElementByNumber(int $number);
  • Get an element by category
$Periodic->getElementsByCategory(string $category);
  • Get a collection of elements by atomic mass range
$Periodic->getElementsByAtomicMass(float $min, float $max);
  • Get an element by phase
$Periodic->getElementsByPhase(string $phase);
  • Get a collection of elements by melting point range
$Periodic->getElementsByMeltingPoint(float $min, float $max);
  • Get a collection of elements by boiling point range
$Periodic->getElementsByBoilingPoint(float $min, float $max);
  • Get a collection of elements by density range
$Periodic->getElementsByDensity(float $min, float $max);

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d537769746368436174266d6573736167653d4167656e637926636f6c6f723d666637373031267374796c653d666f722d7468652d6261646765

Based on the work of Bowserinator/Periodic-Table-JSON

Periodic-Table-JSON

A json of the entire periodic table. Feel free to use it in your projects.

Temperatures such as boiling points and melting points are given in degrees kelvin. Densities are given in g/l for gases and g/cm³ for solids and liquids and molar heat in (mol*K). Information that is missing is represented as null. Some elements may have an image link to their spectral bands.

All elements have a three sentence summary from Wikipedia. Currently the color tag is useless, so please use appearance instead.

Electron configuration is given as a string, with each orbital separated by a space. Electron configuration semantic is given as a string, this is the short-hand version of the electron configuration. Elements with a semantic electron configuration marked with a "*" mean that the electron configuration has not yet been confirmed. Electron shells are given as an array, the first item is the number of electrons in the first shell, the 2nd item is the number of electrons in the second shell, and so on.

Both ionization energy and first electron affinities are given as the energy required to detach an electron from the anion. Ionization energies are given as an array for successive ionization energy.

A link to the source where the information was from is provided in each element under the key "source".

Here's an example of how it's formatted:

{
	"elements" : [{
		"name": "Hydrogen",
		"symbol": "H",
		"number": 1,
		"period": 1,
		"category": "diatomic nonmetal ",
		"atomic_mass": 1.008,
		"color": null,
		"appearance": "colorless gas",
		"phase": "Gas",
		"melt": 13.99,
		"boil": 20.271,
		"density": 0.08988,
		"discovered_by": "Henry Cavendish",
		"molar_heat": 28.836,
		"source":"https://en.wikipedia.org/wiki/Hydrogen",
		"named_by": "Antoine Lavoisier",
		"spectral_img": "https://en.wikipedia.org/wiki/File:Hydrogen_Spectra.jpg",
		"summary": "Hydrogen is a chemical element with chemical symbol H and atomic number 1. With an atomic weight of 1.00794 u, hydrogen is the lightest element on the periodic table. Its monatomic form (H) is the most abundant chemical substance in the Universe, constituting roughly 75% of all baryonic mass.",
		"ypos": 1,
		"xpos": 1,
		"shells": [
			1
		],
		"electron_configuration": "1s1",
		"electron_configuration_semantic": "1s1", 
		"electron_affinity": 72.769,
		"electronegativity_pauling": 2.20,
		"ionization_energies": [
			1312.0
		],
		"cpk-hex": "ffffff"
	}]
}