Download the PHP package walnut/lang without Composer
On this page you can find all versions of the php package walnut/lang. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package lang
Short Description Walnut is a modern functional programming language that combines powerful type system features with practical programming constructs. Designed for building robust applications, Walnut emphasizes type safety, immutability, and clear error handling while maintaining excellent developer ergonomics.
License MIT
Informations about the package lang
Walnut Language
A strongly-typed, functional programming language for modeling and executing business logic with precision and clarity
Overview
Walnut is a modern functional programming language that combines powerful type system features with practical programming constructs. Designed for building robust applications, Walnut emphasizes type safety, immutability, and clear error handling while maintaining excellent developer ergonomics.
Key Features
- 🎯 Expressive Type System - Set-theory based types with union, intersection, and refinement types
- 🔒 Type Safety - Strong static type checking with comprehensive type inference
- ⚡ Functional Core - Immutability by default with first-class functions and lambda expressions
- 💉 Built-in Dependency Injection - Compile-time dependency resolution and service management
- 🛡️ Sophisticated Error Handling - Result types with automatic error propagation
- 🔧 Method-Oriented Design - Behavior-driven functions attached to types
- 📦 Module System - Package-based organization with explicit dependency management
- 🌐 JSON Integration - First-class support for JSON parsing and type-safe hydration
Quick Start
Installation
Choose your installation method:
Option 1: Standalone CLI (Recommended for Development, requires PHP 8.4+ installed)
Download the latest CLI bundle (includes everything needed):
Extract and run:
Option 2: Via Composer (For PHP Projects)
Option 3: Production HTTP Server with RoadRunner
Download the server bundle for your platform:
Hello World
Create a file hello.nut:
Run it:
Language Highlights
Powerful Type System
Walnut features one of the most expressive type systems among programming languages:
Functional Programming
First-class functions, immutability, and powerful transformation operations:
Error Handling with Result Types
Type-safe error handling without exceptions:
Method-Oriented Design
Attach behavior to types with methods:
Type-Safe JSON Hydration
Convert external data to typed values with validation:
Built-in Dependency Injection
Every function or method can declare dependencies that are automatically resolved at compile time:
Documentation
Walnut comes with comprehensive documentation organized into 5 major parts:
📚 Complete Language Specification
Part I: Fundamentals
- Lexical Structure - Tokens, keywords, operators
- Type System - Type hierarchy and subtyping rules
- Values and Literals - Literal syntax and type inference
Part II: Type Definitions
- User-Defined Types - Atoms, enumerations, data types
- Type Refinement - Constraints and value subsets
- Integers and Reals - Numeric types and operations
- Strings - String operations and methods
- Booleans - Boolean logic and operations
- Arrays and Tuples - Collection types
- Maps and Records - Key-value structures
- Union and Intersection Types - Complex type compositions
- Mutable Values - Controlled mutability
- Reflection and Metaprogramming - Type introspection
Part III: Functions, Methods, and Control Flow
- Functions - Function syntax and parameters
- Methods - Method definitions and resolution
- Constructors and Casts - Type conversions
- Expressions - Expression categories
- Conditional Expressions - Pattern matching
- Early Returns and Error Handling - Error propagation
Part IV: Built-in Library
- Core Methods - Built-in operations on all types
- Standard Library Types - Clock, Random, File, HTTP, Database
Part V: Advanced Features
- Hydration - Runtime type conversion and validation
- Module System - Code organization
- Dependency Injection - Service management
- Entry Points - CLI and HTTP interfaces
- Testing - Test framework
- Templates - HTML template system
Examples
Web Service Example
Data Processing Pipeline
Resources
- 🌐 Online Demos - Try Walnut in your browser
- 📦 Example Projects - Downloadable demo applications
- 📖 Full Documentation - Complete language specification
- 🐛 Issue Tracker - Report bugs and request features
Project Structure
Philosophy
Walnut is designed around several core principles:
- Type Safety First - Catch errors at compile time, not runtime
- Immutability by Default - Predictable, side-effect-free code
- Explicit Over Implicit - Clear intent and dependencies
- Business Logic Focus - Express domain models precisely
- Developer Ergonomics - Concise syntax without sacrificing clarity
Distribution Models
Walnut is available in two independent distributions:
walnut.phar (Pure CLI)
- Size: 3.0 MB
- For: Development, testing, scripts
- Features: CLI execution, testing framework, development HTTP server
- Download: From GitHub Releases
walnut-roadrunner (Production Server)
- Size: 18-19 MB (platform-specific)
- For: Production HTTP servers
- Features: High-performance RoadRunner server, multiple workers
- Platforms: Linux x86-64, macOS Intel, macOS Apple Silicon
- Download: From GitHub Releases
Why separate? The CLI doesn't need RoadRunner code, so we keep it lightweight. The server bundle is self-contained and ready to deploy.
Contributing
Contributions are welcome! Please feel free to submit pull requests, report bugs, or suggest features through the issue tracker.
License
Walnut Language is open-source software licensed under the MIT license.
Acknowledgments
Walnut draws inspiration from functional languages like Haskell and ML, type systems from TypeScript and Flow, and practical features from modern languages like Rust and Kotlin.
Ready to start? Check out the Online Demos!
All versions of lang with dependencies
kapitancho/walex Version ^0.0.1
ext-mbstring Version *
ext-bcmath Version *